forked from dixonary/draft-reMarkable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
draft-rm-uninstall
executable file
·47 lines (41 loc) · 1.08 KB
/
draft-rm-uninstall
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
#!/bin/bash
# This will undeploy the draft-reMarkable service from a remote machine by
# stopping services and removing symlinks. /home/root/draft won't be modified.
usage() {
echo "usage: $0 [-y] REMARKABLE_IP"
echo
echo "Undeploys draft-reMarkable service from REMARKABLE_IP by stopping services and removing symlinks."
echo "/home/root/draft won't be modified or removed."
echo
echo " -y Automatic yes to all prompts"
echo
echo "Type '$0 --help' or '$0 -h' to see this message."
}
while getopts ":y" option; do
case $option in
y)
answer="Y"
shift
;;
*)
usage
exit 1
;;
esac
done
if [ $OPTIND < 1 || $OPTIND > 2 ]; then
usage
exit 1
fi
device=$1
if [ "$answer" != "Y" ]; then
read -p "Unlink draft and disable service from $device? (Y/n): " unlinkstep
[ $unlinkstep != "Y" -a $unlinkstep != "y" ] && exit 1
fi
set -e
ssh root@$device <<EOH
set -ex
systemctl start xochitl
systemctl stop draft
rm -rf /lib/systemd/system/draft.service /etc/draft /usr/share/draft /usr/bin/draft
EOH