-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
47 lines (43 loc) · 1.84 KB
/
Copy pathuninstall.sh
File metadata and controls
47 lines (43 loc) · 1.84 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
#!/bin/bash
readonly BOOTFILE=/boot/config.txt
readonly SCRIPTDIR=/opt/RetroFlag
echo "Try to delete dir: $SCRIPTDIR"
if [[ -d "$SCRIPTDIR" ]]; then
rm -rf "$SCRIPTDIR"
[[ $? -eq 0 ]] && echo "'$SCRIPTDIR': removed sucessfull!" || echo "'$SCRIPTDIR': removal failed!"
else
echo "Can't find directory '$SCRIPTDIR'"
echo "Proceed...."
fi
echo
echo "Try to remove autostart-feature"
if grep -q "^sudo python3 $SCRIPTDIR" "/etc/rc.local"; then
sed -i -e "s|^sudo python3.*||g" "/etc/rc.local"
[[ $? -eq 0 ]] && echo "Autostart disabled" || echo "Autostart nothing changed"
elif grep -q "sudo python $SCRIPTDIR" "/etc/rc.local"; then
sed -i -e "s|sudo python.*||g" "/etc/rc.local"
[[ $? -eq 0 ]] && echo "Autostart disabled" || echo "Autostart nothing changed"
else
echo "Autoremove failed!"
echo "Sorry!"
exit 1
fi
echo "Try to disable UART"
if grep -q "^[ ]*enable_uart=1" "$BOOTFILE"; then
sed -i -e "s|^\senable_uart=1|#enable_uart=1|" "$BOOTFILE" &> /dev/null
[[ $? -eq 0 ]] && echo "UART disabled" || echo "Can't disable UART"
else
echo "UART seems to be disabled now!"
echo "'$BOOTFILE':Please check manually!"
fi
echo "Try to disable overlay file"
if grep -q "^[ ]*dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1" "$BOOTFILE"; then
sed -i -e "s|^\s*dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1|#dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1|" "$BOOTFILE" &> /dev/null
[[ $? -eq 0 ]] && echo "overlay disabled" || echo "Can't find overlay file"
elif grep -q "^[ ]*dtoverlay=RetroFlag_pw_io.dtbo" $BOOTFILE; then
sed -i -e "s|^\s*dtoverlay=RetroFlag_pw_io.dtbo|#dtoverlay=RetroFlag_pw_io.dtbo|" "$BOOTFILE" &> /dev/null
[[ $? -eq 0 ]] && echo "overlay disabled" || echo "Can't find overlay file"
else
echo "Overlay file not found"
echo "'$BOOTFILE':Please check manually!"
fi