This commit is contained in:
tteckster 2023-03-22 15:21:30 -04:00 committed by GitHub
parent 38381bb6ef
commit 5b1bcc0ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 188 additions and 182 deletions

View File

@ -6,8 +6,8 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/next/misc/alpin
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
clear clear
cat <<"EOF" cat <<"EOF"
___ __ __ ___ __ __
/ | ____/ /___ ___ ______ __________/ / / | ____/ /___ ___ ______ __________/ /
/ /| |/ __ / __ / / / / __ / ___/ __ / / /| |/ __ / __ / / / / __ / ___/ __ /
@ -52,22 +52,22 @@ function default_settings() {
} }
function update_script() { function update_script() {
UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \ UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 2 \
"1" "Update LXC OS" ON \ "1" "Update LXC OS" ON \
"2" "Manually Update $APP" OFF \ "2" "Manually Update $APP" OFF \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
header_info
if [ "$UPD" == "1" ]; then
apk update && apk upgrade
exit;
fi
if [ "$UPD" == "2" ]; then
header_info header_info
echo "In the process of creating a method to update" if [ "$UPD" == "1" ]; then
exit; apk update && apk upgrade
fi exit
fi
if [ "$UPD" == "2" ]; then
header_info
echo "In the process of creating a method to update"
exit
fi
} }
start start

View File

@ -6,8 +6,8 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/next/misc/alpin
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
clear clear
cat <<"EOF" cat <<"EOF"
____ __ ____ __
/ __ \____ _____/ /_ __ _____ / __ \____ _____/ /_ __ _____
/ / / / __ \/ ___/ //_/ _ \/ ___/ / / / / __ \/ ___/ //_/ _ \/ ___/
@ -52,15 +52,15 @@ function default_settings() {
} }
function update_script() { function update_script() {
UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \ UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \
"1" "Check for Docker Updates" ON \ "1" "Check for Docker Updates" ON \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
header_info header_info
if [ "$UPD" == "1" ]; then if [ "$UPD" == "1" ]; then
apk update && apk upgrade apk update && apk upgrade
exit; exit
fi fi
} }
start start

View File

@ -6,8 +6,8 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/next/misc/debia
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
clear clear
cat <<"EOF" cat <<"EOF"
_ _ _ _ ___ _ _ _ _ ___
/\ /\___ _ __ ___ ___ /_\ ___ ___(_)___| |_ __ _ _ __ | |_ / __\___ _ __ ___ /\ /\___ _ __ ___ ___ /_\ ___ ___(_)___| |_ __ _ _ __ | |_ / __\___ _ __ ___
/ /_/ / _ \| '_ ` _ \ / _ \ //_\\/ __/ __| / __| __/ _` | '_ \| __| / / / _ \| '__/ _ \ / /_/ / _ \| '_ ` _ \ / _ \ //_\\/ __/ __| / __| __/ _` | '_ \| __| / / / _ \| '__/ _ \
@ -51,68 +51,71 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -d /srv/homeassistant ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /srv/homeassistant ]]; then
PY=$(ls /srv/homeassistant/lib/) msg_error "No ${APP} Installation Found!"
IP=$(hostname -I | awk '{print $1}') exit
fi
PY=$(ls /srv/homeassistant/lib/)
IP=$(hostname -I | awk '{print $1}')
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \ UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
"1" "Update Core" ON \ "1" "Update Core" ON \
"2" "Install HACS" OFF \ "2" "Install HACS" OFF \
"3" "Install FileBrowser" OFF \ "3" "Install FileBrowser" OFF \
"4" "Install/Update AppDaemon" OFF \ "4" "Install/Update AppDaemon" OFF \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
header_info header_info
if [ "$UPD" == "1" ]; then if [ "$UPD" == "1" ]; then
if (whiptail --defaultno --title "SELECT BRANCH" --yesno "Use Beta Branch?" 10 58); then if (whiptail --defaultno --title "SELECT BRANCH" --yesno "Use Beta Branch?" 10 58); then
clear clear
header_info header_info
echo -e "${GN}Updating to Version ${BETA}${CL}" echo -e "${GN}Updating to Version ${BETA}${CL}"
BR="--pre " BR="--pre "
else else
clear clear
header_info header_info
echo -e "${GN}Updating to Version ${STABLE}${CL}" echo -e "${GN}Updating to Version ${STABLE}${CL}"
BR="" BR=""
fi
if [[ "$PY" == "python3.9" ]]; then echo -e "⚠️ Python 3.9 is deprecated and will be removed in Home Assistant 2023.2"; fi
msg_info "Stopping Home Assistant"
systemctl stop homeassistant
msg_ok "Stopped Home Assistant"
msg_info "Updating Home Assistant"
source /srv/homeassistant/bin/activate
pip install ${BR}--upgrade homeassistant &>/dev/null
msg_ok "Updated Home Assistant"
msg_info "Starting Home Assistant"
systemctl start homeassistant
sleep 2
msg_ok "Started Home Assistant"
msg_ok "Update Successful"
echo -e "\n Go to http://${IP}:8123 \n"
exit
fi fi
if [[ "$PY" == "python3.9" ]]; then echo -e "⚠️ Python 3.9 is deprecated and will be removed in Home Assistant 2023.2"; fi if [ "$UPD" == "2" ]; then
msg_info "Installing Home Assistant Comunity Store (HACS)"
apt update &>/dev/null
apt install unzip &>/dev/null
cd .homeassistant
bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null
msg_ok "Installed Home Assistant Comunity Store (HACS)"
echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n"
exit
fi
if [ "$UPD" == "3" ]; then
msg_info "Installing FileBrowser"
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash &>/dev/null
filebrowser config init -a '0.0.0.0' &>/dev/null
filebrowser config set -a '0.0.0.0' &>/dev/null
filebrowser users add admin changeme --perm.admin &>/dev/null
msg_ok "Installed FileBrowser"
msg_info "Stopping Home Assistant" msg_info "Creating Service"
systemctl stop homeassistant service_path="/etc/systemd/system/filebrowser.service"
msg_ok "Stopped Home Assistant" echo "[Unit]
msg_info "Updating Home Assistant"
source /srv/homeassistant/bin/activate
pip install ${BR}--upgrade homeassistant &>/dev/null
msg_ok "Updated Home Assistant"
msg_info "Starting Home Assistant"
systemctl start homeassistant
sleep 2
msg_ok "Started Home Assistant"
msg_ok "Update Successful"
echo -e "\n Go to http://${IP}:8123 \n"
exit
fi
if [ "$UPD" == "2" ]; then
msg_info "Installing Home Assistant Comunity Store (HACS)"
apt update &>/dev/null
apt install unzip &>/dev/null
cd .homeassistant
bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null
msg_ok "Installed Home Assistant Comunity Store (HACS)"
echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n"
exit
fi
if [ "$UPD" == "3" ]; then
msg_info "Installing FileBrowser"
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash &>/dev/null
filebrowser config init -a '0.0.0.0' &>/dev/null
filebrowser config set -a '0.0.0.0' &>/dev/null
filebrowser users add admin changeme --perm.admin &>/dev/null
msg_ok "Installed FileBrowser"
msg_info "Creating Service"
service_path="/etc/systemd/system/filebrowser.service"
echo "[Unit]
Description=Filebrowser Description=Filebrowser
After=network-online.target After=network-online.target
[Service] [Service]
@ -122,26 +125,26 @@ ExecStart=/usr/local/bin/filebrowser -r /root/.homeassistant
[Install] [Install]
WantedBy=default.target" >$service_path WantedBy=default.target" >$service_path
systemctl enable --now filebrowser.service &>/dev/null systemctl enable --now filebrowser.service &>/dev/null
msg_ok "Created Service" msg_ok "Created Service"
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "FileBrowser should be reachable by going to the following URL. echo -e "FileBrowser should be reachable by going to the following URL.
${BL}http://$IP:8080${CL} admin|changeme\n" ${BL}http://$IP:8080${CL} admin|changeme\n"
exit exit
fi fi
if [ "$UPD" == "4" ]; then if [ "$UPD" == "4" ]; then
clear clear
header_info header_info
if [[ ! -d /srv/appdaemon ]]; then if [[ ! -d /srv/appdaemon ]]; then
msg_info "Installing AppDaemon" msg_info "Installing AppDaemon"
mkdir /srv/appdaemon mkdir /srv/appdaemon
cd /srv/appdaemon cd /srv/appdaemon
python3 -m venv . python3 -m venv .
source bin/activate source bin/activate
pip install appdaemon &>/dev/null pip install appdaemon &>/dev/null
mkdir -p /root/.homeassistant/appdaemon/apps mkdir -p /root/.homeassistant/appdaemon/apps
cat > /root/.homeassistant/appdaemon/appdaemon.yaml << EOF cat >/root/.homeassistant/appdaemon/appdaemon.yaml <<EOF
# Sample appdaemon.yml file # Sample appdaemon.yml file
# For configuration, please visit: https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html # For configuration, please visit: https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html
appdaemon: appdaemon:
@ -159,10 +162,10 @@ http:
admin: admin:
api: api:
EOF EOF
msg_ok "Installed AppDaemon" msg_ok "Installed AppDaemon"
msg_info "Creating Service" msg_info "Creating Service"
cat > /etc/systemd/system/appdaemon.service << EOF cat >/etc/systemd/system/appdaemon.service <<EOF
[Unit] [Unit]
Description=AppDaemon Description=AppDaemon
After=homeassistant.service After=homeassistant.service
@ -175,33 +178,33 @@ RestartForceExitStatus=100
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable --now appdaemon &>/dev/null systemctl enable --now appdaemon &>/dev/null
msg_ok "Created Service" msg_ok "Created Service"
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "AppDaemon should be reachable by going to the following URL. echo -e "AppDaemon should be reachable by going to the following URL.
${BL}http://$IP:5050${CL}\n" ${BL}http://$IP:5050${CL}\n"
exit exit
else else
msg_info "Upgrading AppDaemon" msg_info "Upgrading AppDaemon"
msg_info "Stopping AppDaemon" msg_info "Stopping AppDaemon"
systemctl stop appdaemon systemctl stop appdaemon
msg_ok "Stopped AppDaemon" msg_ok "Stopped AppDaemon"
msg_info "Updating AppDaemon" msg_info "Updating AppDaemon"
source /srv/appdaemon/bin/activate source /srv/appdaemon/bin/activate
pip install --upgrade appdaemon &>/dev/null pip install --upgrade appdaemon &>/dev/null
msg_ok "Updated AppDaemon" msg_ok "Updated AppDaemon"
msg_info "Starting AppDaemon" msg_info "Starting AppDaemon"
systemctl start appdaemon systemctl start appdaemon
sleep 2 sleep 2
msg_ok "Started AppDaemon" msg_ok "Started AppDaemon"
msg_ok "Update Successful" msg_ok "Update Successful"
echo -e "\n Go to http://${IP}:5050 \n" echo -e "\n Go to http://${IP}:5050 \n"
exit exit
fi
fi fi
fi
} }
start start

View File

@ -6,8 +6,8 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/next/misc/debia
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info { function header_info {
clear clear
cat <<"EOF" cat <<"EOF"
__ __ ___ _ __ __ __ __ ___ _ __ __
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_
/ /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/ / /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/
@ -51,60 +51,63 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -d /var/lib/docker/volumes/hass_config/_data ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /var/lib/docker/volumes/hass_config/_data ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \ UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 4 \
"1" "Update ALL Containers" ON \ "1" "Update ALL Containers" ON \
"2" "Remove ALL Unused Images" OFF \ "2" "Remove ALL Unused Images" OFF \
"3" "Install HACS" OFF \ "3" "Install HACS" OFF \
"4" "Install FileBrowser" OFF \ "4" "Install FileBrowser" OFF \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
header_info header_info
if [ "$UPD" == "1" ]; then if [ "$UPD" == "1" ]; then
msg_info "Updating All Containers" msg_info "Updating All Containers"
CONTAINER_LIST="${1:-$(docker ps -q)}" CONTAINER_LIST="${1:-$(docker ps -q)}"
for container in ${CONTAINER_LIST}; do for container in ${CONTAINER_LIST}; do
CONTAINER_IMAGE="$(docker inspect --format "{{.Config.Image}}" --type container ${container})" CONTAINER_IMAGE="$(docker inspect --format "{{.Config.Image}}" --type container ${container})"
RUNNING_IMAGE="$(docker inspect --format "{{.Image}}" --type container "${container}")" RUNNING_IMAGE="$(docker inspect --format "{{.Image}}" --type container "${container}")"
docker pull "${CONTAINER_IMAGE}" docker pull "${CONTAINER_IMAGE}"
LATEST_IMAGE="$(docker inspect --format "{{.Id}}" --type image "${CONTAINER_IMAGE}")" LATEST_IMAGE="$(docker inspect --format "{{.Id}}" --type image "${CONTAINER_IMAGE}")"
if [[ "${RUNNING_IMAGE}" != "${LATEST_IMAGE}" ]]; then if [[ "${RUNNING_IMAGE}" != "${LATEST_IMAGE}" ]]; then
echo "Updating ${container} image ${CONTAINER_IMAGE}" echo "Updating ${container} image ${CONTAINER_IMAGE}"
DOCKER_COMMAND="$(runlike "${container}")" DOCKER_COMMAND="$(runlike "${container}")"
docker rm --force "${container}" docker rm --force "${container}"
eval ${DOCKER_COMMAND} eval ${DOCKER_COMMAND}
fi fi
done done
msg_ok "Updated All Containers" msg_ok "Updated All Containers"
exit exit
fi fi
if [ "$UPD" == "2" ]; then if [ "$UPD" == "2" ]; then
msg_info "Removing ALL Unused Images" msg_info "Removing ALL Unused Images"
docker image prune -af docker image prune -af
msg_ok "Removed ALL Unused Images" msg_ok "Removed ALL Unused Images"
exit exit
fi fi
if [ "$UPD" == "3" ]; then if [ "$UPD" == "3" ]; then
msg_info "Installing Home Assistant Comunity Store (HACS)" msg_info "Installing Home Assistant Comunity Store (HACS)"
apt update &>/dev/null apt update &>/dev/null
apt install unzip &>/dev/null apt install unzip &>/dev/null
cd /var/lib/docker/volumes/hass_config/_data cd /var/lib/docker/volumes/hass_config/_data
bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null bash <(curl -fsSL https://get.hacs.xyz) &>/dev/null
msg_ok "Installed Home Assistant Comunity Store (HACS)" msg_ok "Installed Home Assistant Comunity Store (HACS)"
echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n" echo -e "\n Reboot Home Assistant and clear browser cache then Add HACS integration.\n"
exit exit
fi fi
if [ "$UPD" == "4" ]; then if [ "$UPD" == "4" ]; then
IP=$(hostname -I | awk '{print $1}') IP=$(hostname -I | awk '{print $1}')
msg_info "Installing FileBrowser" msg_info "Installing FileBrowser"
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash &>/dev/null curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash &>/dev/null
filebrowser config init -a '0.0.0.0' &>/dev/null filebrowser config init -a '0.0.0.0' &>/dev/null
filebrowser config set -a '0.0.0.0' &>/dev/null filebrowser config set -a '0.0.0.0' &>/dev/null
filebrowser users add admin changeme --perm.admin &>/dev/null filebrowser users add admin changeme --perm.admin &>/dev/null
msg_ok "Installed FileBrowser" msg_ok "Installed FileBrowser"
msg_info "Creating Service" msg_info "Creating Service"
service_path="/etc/systemd/system/filebrowser.service" service_path="/etc/systemd/system/filebrowser.service"
echo "[Unit] echo "[Unit]
Description=Filebrowser Description=Filebrowser
After=network-online.target After=network-online.target
[Service] [Service]
@ -114,14 +117,14 @@ ExecStart=/usr/local/bin/filebrowser -r /
[Install] [Install]
WantedBy=default.target" >$service_path WantedBy=default.target" >$service_path
systemctl enable --now filebrowser.service &>/dev/null systemctl enable --now filebrowser.service &>/dev/null
msg_ok "Created Service" msg_ok "Created Service"
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "FileBrowser should be reachable by going to the following URL. echo -e "FileBrowser should be reachable by going to the following URL.
${BL}http://$IP:8080${CL} admin|changeme\n" ${BL}http://$IP:8080${CL} admin|changeme\n"
exit exit
fi fi
} }
start start