-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
50 lines (39 loc) · 1.14 KB
/
uninstall.sh
File metadata and controls
50 lines (39 loc) · 1.14 KB
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
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SERVICE_NAME=$(basename $SCRIPT_DIR)
# make sure SERVICE_NAME is set and not empty
if [ -z "$SERVICE_NAME" ]; then
echo "Error: SERVICE_NAME is not set."
exit 1
fi
echo
echo "Uninstalling $SERVICE_NAME..."
# Remove driver from rc.local
echo "Removing driver from rc.local..."
sed -i "/$SERVICE_NAME/d" /data/rc.local
# Stop the service
echo "Stopping service..."
svc -d /service/$SERVICE_NAME
sleep 1
# Remove service driver
echo "Removing driver from services..."
rm /service/$SERVICE_NAME
# kill
pkill -f "supervise .*$SERVICE_NAME"
pkill -f "multilog .*$SERVICE_NAME"
pkill -f "python .*$SERVICE_NAME"
echo "done."
echo
# Ask the user if they want to delete the service folder
echo "Do you also want to delete all driver files including the config? [y/N]"
read -r DELETE_FILES
if [[ "$DELETE_FILES" == "y" || "$DELETE_FILES" == "Y" ]]; then
echo "Deleting all driver files..."
rm -rf "$SCRIPT_DIR"
echo "done."
else
echo "Driver files not deleted."
fi
echo
echo "*** Please reboot your device to complete the uninstallation. ***"
echo