Current section

Files

Jump to
mix_deploy priv templates copy-files.eex
Raw

priv/templates/copy-files.eex

#!/bin/sh
# Copy files to target or staging directory
#
# This is useful when installing on the local machine or packaging files.
set -e
# Environment vars
# DESTDIR, prefix for target files, optional
# Config vars
DEPLOY_USER="${DEPLOY_USER:-"<%= deploy_user %>"}"
DEPLOY_GROUP="${DEPLOY_GROUP:-"<%= deploy_group %>"}"
APP_USER="${APP_USER:-"<%= app_user %>"}"
APP_GROUP="${APP_GROUP:-"<%= app_group %>"}"
<%= for file <- copy_files, file[:enabled] != false do %>
cp -v <%= file.src %> "${DESTDIR}<%= file.dst %>"
<%= if file[:user] do %>chown "<%= file.user %>:<%= file.group %>" "${DESTDIR}<%= file.dst %>"<% end %>
<%= if file[:mode] do %>chmod <%= file.mode %> "${DESTDIR}<%= file.dst %>"<% end %>
<% end %>