Update homeassistant-core-v5.sh

This commit is contained in:
tteckster 2023-01-07 11:57:13 -05:00 committed by GitHub
parent 1dc7c180d3
commit 025c7f45ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -317,10 +317,11 @@ function install_script() {
function update_script() {
PY=$(ls /srv/homeassistant/lib/)
IP=$(hostname -I | awk '{print $1}')
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 3 \
UPD=$(whiptail --title "UPDATE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 4 \
"1" "Initialize" OFF \
"2" "Update Core" ON \
"3" "Install HACS" OFF \
"4" "Install FileBrowser" OFF \
3>&1 1>&2 2>&3)
if [ "$UPD" == "1" ]; then
@ -373,6 +374,35 @@ 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" == "4" ]; then
clear
header_info
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 on $hostname"
msg_info "Creating Service"
service_path="/etc/systemd/system/filebrowser.service"
echo "[Unit]
Description=Filebrowser
After=network-online.target
[Service]
User=root
WorkingDirectory=/root/
ExecStart=/usr/local/bin/filebrowser -r /
[Install]
WantedBy=default.target" >$service_path
systemctl enable --now filebrowser.service &>/dev/null
msg_ok "Created Service"
msg_ok "Completed Successfully!\n"
echo -e "FileBrowser should be reachable by going to the following URL.
${BL}http://$IP:8080${CL} \n"
exit
}
clear
if ! command -v pveversion >/dev/null 2>&1; then update_script; else install_script; fi