Update ha_setup.sh

pull/84/head
tteckster 2022-02-23 15:50:03 -05:00 committed by GitHub
parent 0914b891fd
commit bd0c40d2ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 9 deletions

View File

@ -127,14 +127,12 @@ show_menu(){
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
} }
option_picked(){ option_picked(){
msgcolor=`echo "\033[01;31m"` msgcolor=`echo "\033[01;31m"`
normal=`echo "\033[00;00m"` normal=`echo "\033[00;00m"`
message=${@:-"${normal}Error: No message passed"} message=${@:-"${normal}Error: No message passed"}
printf "${msgcolor}${message}${normal}\n" printf "${msgcolor}${message}${normal}\n"
} }
clear clear
show_menu show_menu
while [ $opt != '' ] while [ $opt != '' ]
@ -170,7 +168,9 @@ while [ $opt != '' ]
option_picked "Backing up Home Assistant Data to root (hass_config)"; option_picked "Backing up Home Assistant Data to root (hass_config)";
rm -r hass_config; rm -r hass_config;
cp -pR /var/lib/docker/volumes/hass_config/ /root/; cp -pR /var/lib/docker/volumes/hass_config/ /root/;
exit; sleep 2;
clear;
show_menu;
;; ;;
5) while true; do 5) while true; do
read -p "Are you sure you want to Restore Home Assistant Data? Proceed(y/n)?" yn read -p "Are you sure you want to Restore Home Assistant Data? Proceed(y/n)?" yn
@ -184,7 +184,9 @@ while [ $opt != '' ]
option_picked "Restoring Home Assistant Data from root (hass_config)"; option_picked "Restoring Home Assistant Data from root (hass_config)";
rm -r /var/lib/docker/volumes/hass_config/_data; rm -r /var/lib/docker/volumes/hass_config/_data;
cp -pR /root/hass_config/_data /var/lib/docker/volumes/hass_config/; cp -pR /root/hass_config/_data /var/lib/docker/volumes/hass_config/;
exit; sleep 2;
clear;
show_menu;
;; ;;
6) while true; do 6) while true; do
read -p "Are you sure you want to Edit Home Assistant Configuration? Proceed(y/n)?" yn read -p "Are you sure you want to Edit Home Assistant Configuration? Proceed(y/n)?" yn
@ -197,7 +199,8 @@ while [ $opt != '' ]
clear; 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; clear;
show_menu;
;; ;;
7) clear; 7) clear;
option_picked "Restarting Home Assistant"; option_picked "Restarting Home Assistant";
@ -207,24 +210,29 @@ while [ $opt != '' ]
8) clear; 8) clear;
option_picked "Just Updating Containers"; option_picked "Just Updating Containers";
./update-containers.sh; ./update-containers.sh;
exit; sleep 2;
clear;
show_menu;
;; ;;
9) clear; 9) clear;
option_picked "Removing Unused Images"; option_picked "Removing Unused Images";
docker image prune -af; docker image prune -af;
exit; sleep 2;
clear;
show_menu;
;; ;;
10) clear; 10) clear;
option_picked "Updating Host OS"; option_picked "Updating Host OS";
apt update && apt upgrade -y; apt update && apt upgrade -y;
exit; sleep 2;
clear;
show_menu;
;; ;;
11) clear; 11) clear;
option_picked "Reboot Host OS"; option_picked "Reboot Host OS";
reboot; reboot;
exit; exit;
;; ;;
x)exit; x)exit;
;; ;;
\n)exit; \n)exit;