-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·47 lines (43 loc) · 1003 Bytes
/
setup
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
#! /bin/bash
exec="continuwall"
path="/usr/local/bin/"
usage="Usage: ${0} <command>\n\
\n\
Commands:\n\
build creates a working executable in a directory 'build/'\n\
clean same as uninstall\n\
install installs into ${path}\n\
uninstall removes all build files and executables\n\
"
if [ "$#" -ne 1 ]; then
printf "$usage"
exit 0
fi
function build() {
pushd src
zip "$exec" *.py
mv "${exec}.zip" "$exec"
echo "#! /usr/bin/env python" | cat - "$exec" > temp && mv temp "$exec"
chmod +x "$exec"
popd
if [ ! -d "build" ]; then
mkdir build
fi
mv "src/$exec" "build/$exec"
}
if [ "$1" == "build" ]; then
build
elif [ "$1" == "clean" ] || [ "$1" == "uninstall" ]; then
if [ -d "build" ]; then
rm -rf build
fi
if [ -f "${path}${exec}" ]; then
rm "${path}${exec}"
fi
elif [ "$1" == "install" ]; then
build
cp "build/$exec" "${path}${exec}"
else
printf "$usage"
exit 0
fi