-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
app
executable file
·75 lines (64 loc) · 1.65 KB
/
app
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
#!/bin/bash
arg=$1
function initialize {
meson build --prefix=/usr
result=$?
if [ $result -gt 0 ]; then
echo "Unable to initialize, please review log"
exit 1
fi
cd build
ninja
result=$?
if [ $result -gt 0 ]; then
echo "Unable to build project, please review log"
exit 2
fi
}
case $1 in
"clean")
sudo rm -rf ./build
;;
"generate-i18n")
initialize
ninja com.github.calo001.luna-pot
ninja com.github.calo001.luna-update-po
;;
"install")
initialize
sudo ninja install
;;
"install-deps")
output=$((dpkg-checkbuilddeps ) 2>&1)
result=$?
if [ $result -eq 0 ]; then
echo "All dependencies are installed"
exit 0
fi
replace="sudo apt install"
pattern="(\([>=<0-9. ]+\))+"
sudo_replace=${output/dpkg-checkbuilddeps: error: Unmet build dependencies:/$replace}
command=$(sed -r -e "s/$pattern//g" <<< "$sudo_replace")
$command
;;
"run")
initialize
./com.github.calo001.luna "${@:2}"
;;
"uninstall")
initialize
sudo ninja uninstall
;;
*)
echo "Usage:"
echo " ./app [OPTION]"
echo ""
echo "Options:"
echo " clean Removes build directories (can require sudo)"
echo " generate-i18n Generates .pot and .po files for i18n (multi-language support)"
echo " install Builds and installs application to the system (requires sudo)"
echo " install-deps Installs missing build dependencies"
echo " run Builds and runs the application"
echo " uninstall Removes the application from the system (requires sudo)"
;;
esac