-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
56 lines (48 loc) · 1.21 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
#!/usr/bin/env bash
CURRENT_DIR="$(pwd)"
BUILD_DIR="/tmp/lowkey/build"
clone_repo(){
cd /tmp
git clone https://github.com/ZaneFerns360/lowkey.git
cd lowkey
}
uninstall_project() {
echo "Uninstalling the project before reinstalling..."
sudo systemctl disable battery-monitor.service
sudo systemctl stop battery-monitor.service
sudo systemctl daemon-reload
sudo cmake --build build --target uninstall
}
install_project() {
echo "Reinstalling the project..."
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR" || exit
cmake ..
make
sudo make install
if [ $? -eq 0 ]; then
#sudo systemctl daemon-reload
#sudo systemctl start battery-monitor.service
echo "Install successful."
else
echo "Install failed."
exit 1
fi
}
start_daemon(){
# battery-monitor check not included since the uninstall script will disable it
systemctl --user daemon-reload
systemctl --user start battery-monitor.service
systemctl --user enable battery-monitor.service
}
clean_up(){
cd ..
rm -r lowkey
}
# Uninstall and then reinstall the project
clone_repo
uninstall_project
install_project
start_daemon
clean_up
cd $CURRENT_DIR # Return to the original directory