-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·30 lines (21 loc) · 933 Bytes
/
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
#!/bin/bash
sudo -v || echo "This script needs sudo privileges..." \
echo "-> sudo ./install.sh" \
exit \
\
SYSTEMD_DIR="/usr/lib/systemd/system"
SCRIPT_DIR="$PWD/scripts"
START_SCRIPT_NAME="start-linux-task-helper.py"
STOP_SCRIPT_NAME="stop-linux-task-helper.sh"
SERVICE_FILE_NAME="linux-task-helper.service"
python3 -m pip install -r requirements.txt
[ -f "$START_SCRIPT_NAME" ] && chmod u+x "$START_SCRIPT_NAME"
[ -f "$SCRIPT_DIR/$STOP_SCRIPT_NAME" ] && chmod u+x "$SCRIPT_DIR/$STOP_SCRIPT_NAME"
( sudo cp -f "$SCRIPT_DIR/$SERVICE_FILE_NAME" "$SYSTEMD_DIR/$SERVICE_FILE_NAME" && \
sudo cp -f "$START_SCRIPT_NAME" "$SYSTEMD_DIR/$START_SCRIPT_NAME" && \
sudo cp -f "$SCRIPT_DIR/$STOP_SCRIPT_NAME" "$SYSTEMD_DIR/$STOP_SCRIPT_NAME" ) \
\
systemctl daemon-reload
echo "Successfully installed service!"
echo "Enable using 'sudo systemctl enable $SERVICE_FILE_NAME'"
echo "Start using 'sudo systemctl start $SERVICE_FILE_NAME'"