Clean and fix scripts in bin directory
This commit is contained in:
52
setup
Normal file
52
setup
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
#
|
||||
# This script is meant for quick & easy install via:
|
||||
# 'curl -sL https://raw.githubusercontent.com/Boukefalos/docker-deployment/master/setup | sh'
|
||||
# or:
|
||||
# 'wget -qO- https://raw.githubusercontent.com/Boukefalos/docker-deployment/master/setup | sh'
|
||||
|
||||
home=/opt/docker
|
||||
url='https://get.docker.io/'
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
if ! command_exists docker; then
|
||||
echo Docker should be installed!
|
||||
exit 0
|
||||
fi
|
||||
|
||||
user="$(id -un 2>/dev/null || true)"
|
||||
|
||||
sh_c='sh -c'
|
||||
if [ "$user" != 'root' ]; then
|
||||
if command_exists sudo; then
|
||||
sh_c='sudo sh -c'
|
||||
elif command_exists su; then
|
||||
sh_c='su -c'
|
||||
else
|
||||
echo >&2 'Error: this installer needs the ability to run commands as root.'
|
||||
echo >&2 'We are unable to find either "sudo" or "su" available to make this happen.'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
curl=''
|
||||
if command_exists curl; then
|
||||
curl='curl -sL'
|
||||
elif command_exists wget; then
|
||||
curl='wget -qO-'
|
||||
elif command_exists busybox && busybox --list-modules | grep -q wget; then
|
||||
curl='busybox wget -qO-'
|
||||
fi
|
||||
|
||||
if [ -z "$DOCKER_HOME" ]; then
|
||||
echo "DOCKER_HOME has not been set, defaulting to $home"
|
||||
export DOCKER_HOME=$home
|
||||
$sh_c "echo DOCKER_HOME=$home >> /etc/environment"
|
||||
fi
|
||||
|
||||
mkdir -p $DOCKER_HOME
|
||||
docker run --rm -v /usr/local/bin:/target jpetazzo/nsenter
|
||||
Reference in New Issue
Block a user