-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·62 lines (49 loc) · 1.17 KB
/
install.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
#!/bin/bash
exe="kdscript"
uninstall (){
sudo rm /usr/bin/$exe
sudo rm /usr/share/man/man8/$exe.8.gz
echo "[INFO] Application uninstalled successfully"
}
clean (){
rm -r build
rm -r dist
echo "[INFO] Cleaned project"
}
if [ "$1" == "clean" ]; then
clean
exit 0
fi
if [ "$1" == "remove" ]; then
uninstall
exit 0
fi
if [ -f "./dist/main" ]; then
# Install the executable
sudo cp ./dist/main /usr/bin/$exe
if [ $? -ne 0 ]; then
echo "[ERRO] Failed to copy the executable to /usr/bin/"
exit 1
fi
echo "[INFO] $exe installed successfully"
# Install man page
sudo install -g 0 -o 0 -m 0644 $exe.man /usr/share/man/man8/$exe.8
sudo gzip /usr/share/man/man8/$exe.8
if [ $? -ne 0 ]; then
echo "[ERRO] Failed to install man page"
exit 1
fi
echo "[INFO] man page installed successfully"
rm *.spec
echo "[INFO] Installation completed successfully."
else
echo "[WARN] $exe is not built. Building..."
pyinstaller --onefile src/main.py
if [[ $? == 0 ]]; then
./install.sh
else
echo "[ERRO] Failed to build $exe"
exit 1
fi
fi
exit 0