-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·86 lines (65 loc) · 2.04 KB
/
uninstall.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Used by read_write_config_json.sh
CONFIG_JSON_FILEPATH=$BASEDIR/config.json
if [ ! -f $CONFIG_JSON_FILEPATH ]; then
echo "$CONFIG_JSON_FILEPATH does not exist."
exit 1
fi
source $BASEDIR/scripts/ensure_sudo.sh
source $BASEDIR/scripts/read_write_config_json.sh
source $BASEDIR/scripts/user_yes_no.sh
source $BASEDIR/scripts/write_boot_config.sh
source $BASEDIR/scripts/systemd_services.sh
#
# Power LED
#
if [ "$(read_config_json disable_power_led)" = true ]; then
write_boot_config "#" true dtparam pwr_led_trigger none
write_boot_config "#" true dtparam pwr_led_activelow off
fi
#
# Activity LED
#
if [ "$(read_config_json disable_activity_led)" = true ]; then
write_boot_config "#" true dtparam act_led_trigger none
write_boot_config "#" true dtparam act_led_activelow off
fi
#
# Ethernet LEDs
#
if [ "$(read_config_json disable_ethernet_leds)" = true ]; then
write_boot_config "" true dtparam eth_led0 0
write_boot_config "" true dtparam eth_led1 0
write_boot_config "#" true dtparam eth_led0 0
write_boot_config "#" true dtparam eth_led1 0
fi
#
# Bluetooth
#
if [ "$(read_config_json disable_bluetooth)" = true ]; then
write_boot_config "#" false dtoverlay disable-bt
sudo systemctl enable hciuart.service >> /dev/null &> /dev/null
sudo systemctl enable bluetooth.service >> /dev/null &> /dev/null
sudo systemctl enable bluealsa.service >> /dev/null &> /dev/null
fi
#
# Wifi
#
if [ "$(read_config_json disable_wifi)" = true ]; then
write_boot_config "#" false dtoverlay disable-wifi
fi
#
# HDMI
#
if [ "$(read_config_json disable_hdmi)" = true ]; then
echo "Depending on your Raspberry Pi model you might want enable the modern graphics driver."
echo "Uncomment dtoverlay=vc4-kms-v3d in /boot/config.txt to do that."
fi
stop_service save_energy.service
rm -f $CONFIG_JSON_FILEPATH
reboot()
{
sudo reboot now
}
user_yes_no "You need to reboot for all changes to take effect. Do you want to REBOOT now?" reboot