-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-dockup.sh
executable file
·67 lines (52 loc) · 1.73 KB
/
install-dockup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
#
#==================================================================#
# install-dockup.sh #
#
# Installer script for dockup.sh - based directly on @gugod's
# perlbrew installer script - https://install.perlbrew.pl
# (github.com/gugod/App-perlbrew/blob/develop/perlbrew-install)
# #
#==================================================================#
if [ -z "$DOCKUP_INSTALL_DIR" ]; then
DOCKUP_INSTALL_DIR="/usr/local/bin"
fi
if [ -z "$TMPDIR" ]; then
if [ -d "/tmp" ]; then
TMPDIR="/tmp"
cd $TMPDIR || clean_exit 1
else
TMPDIR="."
fi
fi
clean_exit () {
[ -f $LOCALINSTALLER ] && rm $LOCALINSTALLER
exit $1
}
LOCALINSTALLER=$(mktemp $TMPDIR/_inst-dockup.XXXXXX)
if [ -z "${DOCKUPURL}" ]; then
DOCKUPURL=https://raw.githubusercontent.com/docker-rapi/dockup.sh/master/dockup.sh
fi
echo
if type curl >/dev/null 2>&1; then
DOCKUPDOWNLOAD="curl -f -sS -Lo $LOCALINSTALLER $DOCKUPURL"
elif type fetch >/dev/null 2>&1; then
DOCKUPDOWNLOAD="fetch -o $LOCALINSTALLER $DOCKUPURL"
elif type wget >/dev/null 2>&1; then
DOCKUPDOWNLOAD="wget -nv -O $LOCALINSTALLER $DOCKUPURL"
else
echo "Need either wget, fetch or curl to use $0"
clean_exit
fi
echo "## Downloading latest dockup.sh script..."
$DOCKUPDOWNLOAD || clean_exit 1
DLVERSION=$(bash $LOCALINSTALLER --version) || clean_exit 1
echo " (Successfully downloaded v$DLVERSION)"
echo
echo "## Installing dockup.sh to '$DOCKUP_INSTALL_DIR' [using sudo]:"
echo " (set DOCKUP_INSTALL_DIR to change)"
echo
sudo bash $LOCALINSTALLER --install $DOCKUP_INSTALL_DIR || clean_exit 1
echo
echo "## Done."
rm $LOCALINSTALLER