Hello,
I’m trying to use a shell script (attached) to install an app in an Ubuntu box. Everything seems to initiate OK as about 0.6 GB are downloaded. However, I cannot locate any of the files that were supposed to be in the .elasticluster subdirectory (empty). This might be a very basic question but my guess is that the script might need some modification. Any hint or suggestion would be welcomed. Thanks.
P.S. Apparently new users cannot post attachments (script is 342 lines long) so I’m posting it as a preformatted text.
# put args back for elasticluster python to interpret
set -- $argv
# pull (update) Docker image
elasticluster_docker_image="${docker_image_name}:${docker_image_tag}"
if [ "$pull" = 'yes' ]; then
docker pull "$elasticluster_docker_image"
fi
# cannot run as root, as mountpoints within the Docker image would be
# in the wrong place
if [ $(id -u) -eq 0 ]; then
die $EX_SOFTWARE <<__EOF__
Cannot run as 'root' user: please run ElastiCluster with a normal,
unprivileged user. (But ensure this user has permission to start
and access Docker containers; typically this means being part of
the 'docker' group.)
__EOF__
fi
# cannot run `sftp` in a Docker container
for arg in "$@"; do
if [ "$arg" = 'sftp' ]; then
die $EX_SOFTWARE <<__EOF__
ElastiCluster's 'sftp' command cannot be run in a Docker container.
Please see https://github.com/elasticluster/elasticluster/issues/576
for an explanation and possible workarounds.
__EOF__
fi
done
# ensure mount points exist
for dir in "$HOME/.ssh" "$HOME/.elasticluster"; do
test -d "$dir" || mkdir -v "$dir"
done
# prepare environment to export to Docker
# (necessary e.g. to preserve OpenStack auth)
envfile=$(mktemp -t elasticluster.XXXXXXXXXXXX.env)
if [ -z "$envfile" ]; then
die 1 "Cannot create temporary file."
fi
trap "rm -f '$envfile';" EXIT INT QUIT ABRT TERM
if [ "$env_has_null_termination_opt" = 'y' ]; then
# The following incantation requires some explanation:
#
# * line (1) `env` is to override some environment variables with
# values that are appropriate *within* the container;
#
# * line (2) is for filtering out multi-line env vars,
# which `docker run --env-file` cannot currently handle
# (see https://stackoverflow.com/a/19156442/459543 and
# issue #675 if the `awk` code looks overcomplicated);
#
# * line (3) `egrep -v` is for removing shell customization (e.g.,
# bash/zsh themes with multiline prompts)
#
env -0 HOME="$HOME" SHELL=/bin/sh SSH_AUTH_SOCK=/home/.ssh-agent.sock \
| awk 'BEGIN { RS="\0"; FS="="; OFS="="; }; { n=index($0, "="); $2=substr($0, n+1); NF=2; if ($2 !~ /\n/) print; };' \
| egrep -v '^(BASH_ENV|ENV|PROMPT_COMMAND|PS[1234])=' \
> "$envfile"
else
env HOME="$HOME" SHELL=/bin/sh SSH_AUTH_SOCK=/home/.ssh-agent.sock \
| egrep -v '^(BASH_ENV|ENV|PROMPT_COMMAND|PS[1234])=' \
> "$envfile"
fi
# go!
exec docker run --rm --interactive --tty --env-file "$envfile" $volumes $elasticluster_docker_image "$@"