@@ -21,49 +21,49 @@ error_handler() {
2121
2222trap ' error_handler $LINENO' ERR
2323
24- systemctl stop haos-agent > /dev/null 2>&1 || true
25- systemctl stop hassio-apparmor > /dev/null 2>&1 || true
26- systemctl stop hassio-supervisor > /dev/null 2>&1 || true
27-
28- systemctl disable haos-agent > /dev/null 2>&1 || true
29- systemctl disable hassio-apparmor > /dev/null 2>&1 || true
30- systemctl disable hassio-supervisor > /dev/null 2>&1 || true
31-
32- apt-get remove -y homeassistant-supervised os-agent
33- apt-get remove -y homeassistant-supervised\* > /dev/null 2>&1 || true
34-
35- if [ -f " /usr/bin/docker" ]; then
36- # Stop and kill containers and images.
37- for repo in " ${repositories_to_remove[@]} " ; do
38- images=$( docker images --format " {{.Repository}}:{{.Tag}}" | grep " ^$repo " || true)
39- if [ ! -z " $images " ]; then
40- for image in $images ; do
41- containers=$( docker ps -a -q --filter ancestor=" $image " )
42- if [ -n " $containers " ]; then
43- echo " Stopping containers based on image: $image "
44- docker stop $containers
45- docker rm $containers
46- fi
24+ # systemctl stop haos-agent > /dev/null 2>&1 || true
25+ # systemctl stop hassio-apparmor > /dev/null 2>&1 || true
26+ # systemctl stop hassio-supervisor > /dev/null 2>&1 || true
27+
28+ # systemctl disable haos-agent > /dev/null 2>&1 || true
29+ # systemctl disable hassio-apparmor > /dev/null 2>&1 || true
30+ # systemctl disable hassio-supervisor > /dev/null 2>&1 || true
31+
32+ # apt-get remove -y homeassistant-supervised os-agent
33+ # apt-get remove -y homeassistant-supervised\* > /dev/null 2>&1 || true
34+
35+ # if [ -f "/usr/bin/docker" ]; then
36+ # # Stop and kill containers and images.
37+ # for repo in "${repositories_to_remove[@]}"; do
38+ # images=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "^$repo" || true)
39+ # if [ ! -z "$images" ]; then
40+ # for image in $images; do
41+ # containers=$(docker ps -a -q --filter ancestor="$image")
42+ # if [ -n "$containers" ]; then
43+ # echo "Stopping containers based on image: $image"
44+ # docker stop $containers
45+ # docker rm $containers
46+ # fi
4747
48- echo " Removing image: $image "
49- docker rmi " $image "
50- done
51- fi
52- done
53-
54- echo " Selected containers stopped and images removed successfully."
55-
56- sleep 5
57- docker system prune -a -f > /dev/null 2>&1
58-
59- apt-get remove -y docker-ce docker-ce-cli containerd.io
60- apt-get remove -y docker-compose-plugin
61- apt-get remove -y docker-compose
62- apt-get remove -y docker.io
63- apt-get remove -y docker
64- apt-get remove -y docker-doc
65- apt-get remove -y docker-registry
66- fi
48+ # echo "Removing image: $image"
49+ # docker rmi "$image"
50+ # done
51+ # fi
52+ # done
53+
54+ # echo "Selected containers stopped and images removed successfully."
55+
56+ # sleep 5
57+ # docker system prune -a -f > /dev/null 2>&1
58+
59+ # apt-get remove -y docker-ce docker-ce-cli containerd.io
60+ # apt-get remove -y docker-compose-plugin
61+ # apt-get remove -y docker-compose
62+ # apt-get remove -y docker.io
63+ # apt-get remove -y docker
64+ # apt-get remove -y docker-doc
65+ # apt-get remove -y docker-registry
66+ # fi
6767
6868if [ -f " /etc/hassio.json" ]; then
6969 rm -rf /etc/hassio.json
@@ -77,25 +77,25 @@ if [ -d "/var/lib/homeassistant" ]; then
7777 rm -rf /var/lib/homeassistant
7878fi
7979
80- sync
80+ /usr/bin/ sync
8181
8282sleep 0.5
8383
8484echo " Update WIFI settings ..."
8585
86+ if [ -e " /usr/bin/nmcli" ]; then
87+ nmcli -t -f UUID con show | xargs -I {} nmcli con delete uuid {} 2> /dev/null || true
88+ fi
89+
90+ /usr/bin/sync
91+
8692# reset wifi connection information
8793if [ -e " /etc/wpa_supplicant/wpa_supplicant-nl80211-wlan0.conf" ]; then
8894 rm -rf /etc/wpa_supplicant/wpa_supplicant-nl80211-wlan0.conf
89-
90- if [ -e " /usr/sbin/dhclient" ]; then
91- /usr/sbin/dhclient -r wlan0
92- fi
93-
94- if [ -f " /lib/systemd/system/setupwifi.service" ]; then
95- systemctl disable setupwifi.service
96- fi
9795fi
9896
97+ /usr/bin/sync
98+
9999echo " Factory reset completed. Rebooting now..."
100100
101101sleep 5
0 commit comments