|
|
@ -114,10 +114,14 @@ show_menu(){
|
|
|
|
printf "${menu}**${number} 1)${safe} Switch to Stable Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 1)${safe} Switch to Stable Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 2)${number} Switch to Beta Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 2)${number} Switch to Beta Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 3)${fgred} Switch to Dev Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 3)${fgred} Switch to Dev Branch ${normal}\n"
|
|
|
|
printf "${menu}**${number} 4)${fgred} Edit Home Assistant Configuration ${normal}\n"
|
|
|
|
printf "${menu}**${number} 4)${safe} Backup Home Assistant Data (to root) ${normal}\n"
|
|
|
|
printf "${menu}**${number} 5)${safe} Just Update Containers ${normal}\n"
|
|
|
|
printf "${menu}**${number} 5)${number} Restore Home Assistant Data ${normal}\n"
|
|
|
|
printf "${menu}**${number} 6)${number} Remove Unused Images ${normal}\n"
|
|
|
|
printf "${menu}**${number} 6)${fgred} Edit Home Assistant Configuration ${normal}\n"
|
|
|
|
printf "${menu}**${number} 7)${safe} Update Host OS ${normal}\n"
|
|
|
|
printf "${menu}**${number} 7)${safe} Restart Home Assistant ${normal}\n"
|
|
|
|
|
|
|
|
printf "${menu}**${number} 8)${safe} Just Update Containers ${normal}\n"
|
|
|
|
|
|
|
|
printf "${menu}**${number} 9)${number} Remove Unused Images ${normal}\n"
|
|
|
|
|
|
|
|
printf "${menu}**${number} 10)${safe} Update Host OS ${normal}\n"
|
|
|
|
|
|
|
|
printf "${menu}**${number} 11)${safe} Reboot Host OS ${normal}\n"
|
|
|
|
printf "${menu}*********************************************${normal}\n"
|
|
|
|
printf "${menu}*********************************************${normal}\n"
|
|
|
|
printf "Please choose an option from the menu and enter or ${fgred}x to exit. ${normal}"
|
|
|
|
printf "Please choose an option from the menu and enter or ${fgred}x to exit. ${normal}"
|
|
|
|
read opt
|
|
|
|
read opt
|
|
|
@ -148,31 +152,77 @@ while [ $opt != '' ]
|
|
|
|
TAG=beta
|
|
|
|
TAG=beta
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
3) clear;
|
|
|
|
3) while true; do
|
|
|
|
|
|
|
|
read -p "Are you sure you want to Switch to Dev Branch? Proceed(y/n)?" yn
|
|
|
|
|
|
|
|
case $yn in
|
|
|
|
|
|
|
|
[Yy]* ) break;;
|
|
|
|
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
clear;
|
|
|
|
option_picked "Switching to Dev Branch";
|
|
|
|
option_picked "Switching to Dev Branch";
|
|
|
|
TAG=dev
|
|
|
|
TAG=dev
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
4) clear;
|
|
|
|
4) clear;
|
|
|
|
|
|
|
|
option_picked "Backing up Home Assistant Data to root (hass_config)";
|
|
|
|
|
|
|
|
rm -r hass_config;
|
|
|
|
|
|
|
|
cp -pR /var/lib/docker/volumes/hass_config/ /root/;
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
5) while true; do
|
|
|
|
|
|
|
|
read -p "Are you sure you want to Restore Home Assistant Data? Proceed(y/n)?" yn
|
|
|
|
|
|
|
|
case $yn in
|
|
|
|
|
|
|
|
[Yy]* ) break;;
|
|
|
|
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
clear;
|
|
|
|
|
|
|
|
option_picked "Restoring Home Assistant Data from root (hass_config)";
|
|
|
|
|
|
|
|
rm -r /var/lib/docker/volumes/hass_config/_data;
|
|
|
|
|
|
|
|
cp -pR /root/hass_config/_data /var/lib/docker/volumes/hass_config/;
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
6) while true; do
|
|
|
|
|
|
|
|
read -p "Are you sure you want to Edit Home Assistant Configuration? Proceed(y/n)?" yn
|
|
|
|
|
|
|
|
case $yn in
|
|
|
|
|
|
|
|
[Yy]* ) break;;
|
|
|
|
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
clear;
|
|
|
|
option_picked "Editing Home Assistant Configuration";
|
|
|
|
option_picked "Editing Home Assistant Configuration";
|
|
|
|
nano /var/lib/docker/volumes/hass_config/_data/configuration.yaml;
|
|
|
|
nano /var/lib/docker/volumes/hass_config/_data/configuration.yaml;
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
5) clear;
|
|
|
|
7) clear;
|
|
|
|
|
|
|
|
option_picked "Restarting Home Assistant";
|
|
|
|
|
|
|
|
docker restart homeassistant;
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
8) clear;
|
|
|
|
option_picked "Just Updating Containers";
|
|
|
|
option_picked "Just Updating Containers";
|
|
|
|
./update-containers.sh;
|
|
|
|
./update-containers.sh;
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
6) clear;
|
|
|
|
9) clear;
|
|
|
|
option_picked "Removing Unused Images";
|
|
|
|
option_picked "Removing Unused Images";
|
|
|
|
docker image prune -af;
|
|
|
|
docker image prune -af;
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
7) clear;
|
|
|
|
10) clear;
|
|
|
|
option_picked "Updating Host OS";
|
|
|
|
option_picked "Updating Host OS";
|
|
|
|
apt update && apt upgrade -y;
|
|
|
|
apt update && apt upgrade -y;
|
|
|
|
exit;
|
|
|
|
exit;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
11) clear;
|
|
|
|
|
|
|
|
option_picked "Reboot Host OS";
|
|
|
|
|
|
|
|
reboot;
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
|
|
x)exit;
|
|
|
|
x)exit;
|
|
|
|
;;
|
|
|
|
;;
|
|
|
@ -230,6 +280,6 @@ ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,3840
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
|
|
|
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
|
|
|
|
|
|
|
mkdir /root/hass_config
|
|
|
|
echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m"
|
|
|
|
echo -e "${CHECKMARK} \e[1;92m Cleanup... \e[0m"
|
|
|
|
rm -rf /ha_setup.sh /var/{cache,log}/* /var/lib/apt/lists/*
|
|
|
|
rm -rf /ha_setup.sh /var/{cache,log}/* /var/lib/apt/lists/*
|
|
|
|