-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·89 lines (78 loc) · 2.11 KB
/
install
File metadata and controls
executable file
·89 lines (78 loc) · 2.11 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
#
# Installation script for Unix platforms. To run installation, type :
#
# $ sh -c "$(curl https://sweetohm.net/dist/${NAME}/install)"
#
# or (if you don't have curl installed):
#
# $ sh -c "$(wget -O - https://sweetohm.net/dist/${NAME}/install)"
set -e
DIST_URL="https://sweetohm.net/dist"
# get OS and ARCH and build binary name
os=`uname | tr '[:upper:]' '[:lower:]'`
arch=`uname -m`
if [ "$arch" = "i386" ]; then
arch="386"
elif [ "$arch" = "x86_64" ]; then
arch="amd64"
elif [ "$arch" = "aarch64" ]; then
arch="arm64"
fi
echo "os: ${os}"
echo "arch: ${arch}"
# set default installation directory
if [ -d "/opt/local/bin" ]
then
DEFAULT_DIR="/opt/local/bin"
elif [ -d "/opt/bin" ]
then
DEFAULT_DIR="/opt/bin"
elif [ -d "/usr/local/bin" ]
then
DEFAULT_DIR="/usr/local/bin"
elif [ -d "/usr/bin" ]
then
DEFAULT_DIR="/usr/bin"
else
DEFAULT_DIR="/bin"
fi
# select command to download binary
if hash curl 2>/dev/null
then
command="curl -o"
elif hash wget 2>/dev/null
then
command="wget -O"
else
echo "You must install curl or wget to run this installation script"
exit 1
fi
# prompt for installation directory
read -p "Installation directory [${DEFAULT_DIR}]? " directory
if [ -z "$directory" ]
then
directory=${DEFAULT_DIR}
fi
# download binaries in /tmp/${NAME} and make it executable
${command} /tmp/make-help ${DIST_URL}/make-tools/make-help-${os}-${arch}
chmod +x /tmp/make-help
${command} /tmp/make-targets ${DIST_URL}/make-tools/make-targets-${os}-${arch}
chmod +x /tmp/make-targets
${command} /tmp/make-desc ${DIST_URL}/make-tools/make-desc-${os}-${arch}
chmod +x /tmp/make-desc
# copy binary to installation directory
if [ -w "${directory}" ]
then
mv /tmp/make-help ${directory}
mv /tmp/make-targets ${directory}
mv /tmp/make-desc ${directory}
else
sudo mv /tmp/make-help ${directory}
sudo chown root: ${directory}/make-help
sudo mv /tmp/make-targets ${directory}
sudo chown root: ${directory}/make-targets
sudo mv /tmp/make-desc ${directory}
sudo chown root: ${directory}/make-desc
fi
echo "Make tools installed in '${directory}' directory"