indentation

pull/1213/head
tteckster 2 years ago committed by GitHub
parent 5b1bcc0ae8
commit cb24aaadd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 142
      ct/nginxproxymanager.sh
  2. 75
      ct/paperless-ngx.sh
  3. 59
      ct/photoprism.sh
  4. 117
      ct/vaultwarden.sh
  5. 76
      ct/zigbee2mqtt.sh
  6. 45
      ct/zwave-js-ui.sh

@ -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"
_ __ _ ____ __ ___ _ __ _ ____ __ ___
/ | / /___ _(_)___ _ __ / __ \_________ __ ____ __ / |/ /___ _____ ____ _____ ____ _____ / | / /___ _(_)___ _ __ / __ \_________ __ ____ __ / |/ /___ _____ ____ _____ ____ _____
/ |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/ / |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/
@ -52,50 +52,53 @@ function default_settings() {
} }
function update_script() { function update_script() {
header_info header_info
if [[ ! -f /lib/systemd/system/npm.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -f /lib/systemd/system/npm.service ]]; then
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest | msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
grep "tag_name" | grep "tag_name" |
awk '{print substr($2, 3, length($2)-4) }') awk '{print substr($2, 3, length($2)-4) }')
msg_info "Stopping Services" msg_info "Stopping Services"
systemctl stop openresty systemctl stop openresty
systemctl stop npm systemctl stop npm
msg_ok "Stopped Services" msg_ok "Stopped Services"
msg_info "Cleaning Old Files" msg_info "Cleaning Old Files"
rm -rf /app \ rm -rf /app \
/var/www/html \ /var/www/html \
/etc/nginx \ /etc/nginx \
/var/log/nginx \ /var/log/nginx \
/var/lib/nginx \ /var/lib/nginx \
/var/cache/nginx &>/dev/null /var/cache/nginx &>/dev/null
msg_ok "Cleaned Old Files" msg_ok "Cleaned Old Files"
msg_info "Downloading NPM v${RELEASE}" msg_info "Downloading NPM v${RELEASE}"
wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz &>/dev/null wget -q https://codeload.github.com/NginxProxyManager/nginx-proxy-manager/tar.gz/v${RELEASE} -O - | tar -xz &>/dev/null
cd nginx-proxy-manager-${RELEASE} cd nginx-proxy-manager-${RELEASE}
msg_ok "Downloaded NPM v${RELEASE}" msg_ok "Downloaded NPM v${RELEASE}"
msg_info "Setting up Enviroment" msg_info "Setting up Enviroment"
ln -sf /usr/bin/python3 /usr/bin/python ln -sf /usr/bin/python3 /usr/bin/python
ln -sf /usr/bin/certbot /opt/certbot/bin/certbot ln -sf /usr/bin/certbot /opt/certbot/bin/certbot
ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx ln -sf /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
ln -sf /usr/local/openresty/nginx/ /etc/nginx ln -sf /usr/local/openresty/nginx/ /etc/nginx
sed -i "s+0.0.0+${RELEASE}+g" backend/package.json sed -i "s+0.0.0+${RELEASE}+g" backend/package.json
sed -i "s+0.0.0+${RELEASE}+g" frontend/package.json sed -i "s+0.0.0+${RELEASE}+g" frontend/package.json
sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf sed -i 's+^daemon+#daemon+g' docker/rootfs/etc/nginx/nginx.conf
NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf") NGINX_CONFS=$(find "$(pwd)" -type f -name "*.conf")
for NGINX_CONF in $NGINX_CONFS; do for NGINX_CONF in $NGINX_CONFS; do
sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF" sed -i 's+include conf.d+include /etc/nginx/conf.d+g' "$NGINX_CONF"
done done
mkdir -p /var/www/html /etc/nginx/logs mkdir -p /var/www/html /etc/nginx/logs
cp -r docker/rootfs/var/www/html/* /var/www/html/ cp -r docker/rootfs/var/www/html/* /var/www/html/
cp -r docker/rootfs/etc/nginx/* /etc/nginx/ cp -r docker/rootfs/etc/nginx/* /etc/nginx/
cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini cp docker/rootfs/etc/letsencrypt.ini /etc/letsencrypt.ini
cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-proxy-manager
ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
rm -f /etc/nginx/conf.d/dev.conf rm -f /etc/nginx/conf.d/dev.conf
mkdir -p /tmp/nginx/body \ mkdir -p /tmp/nginx/body \
/run/nginx \ /run/nginx \
/data/nginx \ /data/nginx \
/data/custom_ssl \ /data/custom_ssl \
@ -111,31 +114,30 @@ mkdir -p /tmp/nginx/body \
/var/lib/nginx/cache/public \ /var/lib/nginx/cache/public \
/var/lib/nginx/cache/private \ /var/lib/nginx/cache/private \
/var/cache/nginx/proxy_temp /var/cache/nginx/proxy_temp
chmod -R 777 /var/cache/nginx chmod -R 777 /var/cache/nginx
chown root /tmp/nginx chown root /tmp/nginx
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
echo -e "${CHECKMARK} \e[1;92m Generating dummy SSL Certificate... \e[0m" echo -e "${CHECKMARK} \e[1;92m Generating dummy SSL Certificate... \e[0m"
openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -subj "/O=Nginx Proxy Manager/OU=Dummy Certificate/CN=localhost" -keyout /data/nginx/dummykey.pem -out /data/nginx/dummycert.pem &>/dev/null
fi fi
mkdir -p /app/global /app/frontend/images mkdir -p /app/global /app/frontend/images
cp -r backend/* /app cp -r backend/* /app
cp -r global/* /app/global cp -r global/* /app/global
msg_ok "Setup Enviroment" msg_ok "Setup Enviroment"
msg_info "Building Frontend"
cd ./frontend
export NODE_ENV=development
yarn install --network-timeout=30000 &>/dev/null
yarn build &>/dev/null
cp -r dist/* /app/frontend
cp -r app-images/* /app/frontend/images
msg_ok "Built Frontend"
msg_info "Building Frontend"
cd ./frontend
export NODE_ENV=development
yarn install --network-timeout=30000 &>/dev/null
yarn build &>/dev/null
cp -r dist/* /app/frontend
cp -r app-images/* /app/frontend/images
msg_ok "Built Frontend"
msg_info "Initializing Backend" msg_info "Initializing Backend"
rm -rf /app/config/default.json &>/dev/null rm -rf /app/config/default.json &>/dev/null
if [ ! -f /app/config/production.json ]; then if [ ! -f /app/config/production.json ]; then
cat <<'EOF' >/app/config/production.json cat <<'EOF' >/app/config/production.json
{ {
"database": { "database": {
@ -149,24 +151,24 @@ if [ ! -f /app/config/production.json ]; then
} }
} }
EOF EOF
fi fi
cd /app cd /app
export NODE_ENV=development export NODE_ENV=development
yarn install --network-timeout=30000 &>/dev/null yarn install --network-timeout=30000 &>/dev/null
msg_ok "Initialized Backend" msg_ok "Initialized Backend"
msg_info "Starting Services" msg_info "Starting Services"
systemctl enable npm &>/dev/null systemctl enable npm &>/dev/null
systemctl start openresty systemctl start openresty
systemctl start npm systemctl start npm
msg_ok "Started Services" msg_ok "Started Services"
msg_info "Cleaning up" msg_info "Cleaning up"
rm -rf ~/nginx-proxy-manager-* rm -rf ~/nginx-proxy-manager-*
msg_ok "Cleaned" msg_ok "Cleaned"
msg_ok "Update Successfull" msg_ok "Update Successfull"
exit exit
} }
start start

@ -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"
____ __ ____ __
/ __ \____ _____ ___ _____/ /__ __________ ____ ____ __ __ / __ \____ _____ ___ _____/ /__ __________ ____ ____ __ __
@ -53,26 +53,29 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -d /opt/paperless ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/paperless ]]; then
RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') msg_error "No ${APP} Installation Found!"
SER=/etc/systemd/system/paperless-task-queue.service exit
fi
RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
SER=/etc/systemd/system/paperless-task-queue.service
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 Paperless-ngx to $RELEASE" ON \ "1" "Update Paperless-ngx to $RELEASE" ON \
"2" "Paperless-ngx Credentials" OFF \ "2" "Paperless-ngx Credentials" 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 "Stopping Paperless-ngx" msg_info "Stopping Paperless-ngx"
systemctl stop paperless-consumer paperless-webserver paperless-scheduler systemctl stop paperless-consumer paperless-webserver paperless-scheduler
if [ -f "$SER" ]; then if [ -f "$SER" ]; then
systemctl stop paperless-task-queue.service systemctl stop paperless-task-queue.service
fi fi
sleep 1 sleep 1
msg_ok "Stopped Paperless-ngx" msg_ok "Stopped Paperless-ngx"
msg_info "Updating to ${RELEASE}" msg_info "Updating to ${RELEASE}"
if [ "$(dpkg -l | awk '/libmariadb-dev-compat/ {print }'|wc -l)" != 1 ]; then apt-get install -y libmariadb-dev-compat; fi &>/dev/null if [ "$(dpkg -l | awk '/libmariadb-dev-compat/ {print }' | wc -l)" != 1 ]; then apt-get install -y libmariadb-dev-compat; fi &>/dev/null
wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$RELEASE/paperless-ngx-$RELEASE.tar.xz &>/dev/null wget https://github.com/paperless-ngx/paperless-ngx/releases/download/$RELEASE/paperless-ngx-$RELEASE.tar.xz &>/dev/null
tar -xf paperless-ngx-$RELEASE.tar.xz &>/dev/null tar -xf paperless-ngx-$RELEASE.tar.xz &>/dev/null
cp -r /opt/paperless/paperless.conf paperless-ngx/ cp -r /opt/paperless/paperless.conf paperless-ngx/
@ -85,7 +88,7 @@ msg_info "Updating to ${RELEASE}"
if [ -f "$SER" ]; then if [ -f "$SER" ]; then
msg_ok "paperless-task-queue.service Exists." msg_ok "paperless-task-queue.service Exists."
else else
cat <<EOF >/etc/systemd/system/paperless-task-queue.service cat <<EOF >/etc/systemd/system/paperless-task-queue.service
[Unit] [Unit]
Description=Paperless Celery Workers Description=Paperless Celery Workers
Requires=redis.service Requires=redis.service
@ -95,10 +98,10 @@ ExecStart=celery --app paperless worker --loglevel INFO
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable paperless-task-queue &>/dev/null systemctl enable paperless-task-queue &>/dev/null
msg_ok "paperless-task-queue.service Created." msg_ok "paperless-task-queue.service Created."
fi fi
cat <<EOF >/etc/systemd/system/paperless-scheduler.service cat <<EOF >/etc/systemd/system/paperless-scheduler.service
[Unit] [Unit]
Description=Paperless Celery beat Description=Paperless Celery beat
Requires=redis.service Requires=redis.service
@ -108,26 +111,26 @@ ExecStart=celery --app paperless beat --loglevel INFO
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
msg_ok "Updated to ${RELEASE}" msg_ok "Updated to ${RELEASE}"
msg_info "Cleaning up" msg_info "Cleaning up"
cd ~ cd ~
rm paperless-ngx-$RELEASE.tar.xz rm paperless-ngx-$RELEASE.tar.xz
rm -rf paperless-ngx rm -rf paperless-ngx
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting Paperless-ngx" msg_info "Starting Paperless-ngx"
systemctl daemon-reload systemctl daemon-reload
systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service systemctl start paperless-consumer paperless-webserver paperless-scheduler paperless-task-queue.service
sleep 1 sleep 1
msg_ok "Started Paperless-ngx" msg_ok "Started Paperless-ngx"
msg_ok "Updated Successfully!\n" msg_ok "Updated Successfully!\n"
exit exit
fi fi
if [ "$UPD" == "2" ]; then if [ "$UPD" == "2" ]; then
cat paperless.creds cat paperless.creds
exit exit
fi fi
} }
start start

@ -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"
____ __ ______ __________ ____ ____ _________ __ ___ ____ __ ______ __________ ____ ____ _________ __ ___
/ __ \/ / / / __ \/_ __/ __ \/ __ \/ __ \/ _/ ___// |/ / / __ \/ / / / __ \/_ __/ __ \/ __ \/ __ \/ _/ ___// |/ /
@ -52,36 +52,39 @@ function default_settings() {
} }
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/photoprism ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/photoprism ]]; then
echo -e "\n ⚠ Ensure you set 2vCPU & 3072MiB RAM MIMIMUM!!! \n" msg_error "No ${APP} Installation Found!"
msg_info "Stopping PhotoPrism" exit
sudo systemctl stop photoprism fi
msg_ok "Stopped PhotoPrism" echo -e "\n ⚠ Ensure you set 2vCPU & 3072MiB RAM MIMIMUM!!! \n"
msg_info "Stopping PhotoPrism"
sudo systemctl stop photoprism
msg_ok "Stopped PhotoPrism"
msg_info "Cloning PhotoPrism" msg_info "Cloning PhotoPrism"
git clone https://github.com/photoprism/photoprism.git &>/dev/null git clone https://github.com/photoprism/photoprism.git &>/dev/null
cd photoprism cd photoprism
git checkout release &>/dev/null git checkout release &>/dev/null
msg_ok "Cloned PhotoPrism" msg_ok "Cloned PhotoPrism"
msg_info "Building PhotoPrism" msg_info "Building PhotoPrism"
sudo make all &>/dev/null sudo make all &>/dev/null
sudo ./scripts/build.sh prod /opt/photoprism/bin/photoprism &>/dev/null sudo ./scripts/build.sh prod /opt/photoprism/bin/photoprism &>/dev/null
sudo rm -rf /opt/photoprism/assets sudo rm -rf /opt/photoprism/assets
sudo cp -r assets/ /opt/photoprism/ &>/dev/null sudo cp -r assets/ /opt/photoprism/ &>/dev/null
msg_ok "Built PhotoPrism" msg_ok "Built PhotoPrism"
msg_info "Cleaning" msg_info "Cleaning"
cd ~ cd ~
rm -rf photoprism rm -rf photoprism
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting PhotoPrism" msg_info "Starting PhotoPrism"
sudo systemctl start photoprism sudo systemctl start photoprism
msg_ok "Started PhotoPrism" msg_ok "Started PhotoPrism"
msg_ok "Update Successful" msg_ok "Update Successful"
exit exit
} }
start start

@ -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"
_ __ ____ _ __ __ _ __ ____ _ __ __
| | / /___ ___ __/ / /| | / /___ __________/ /__ ____ | | / /___ ___ __/ / /| | / /___ __________/ /__ ____
@ -52,81 +52,84 @@ function default_settings() {
} }
function update_script() { function update_script() {
if [[ ! -f /etc/systemd/system/vaultwarden.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -f /etc/systemd/system/vaultwarden.service ]]; then
VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest | msg_error "No ${APP} Installation Found!"
exit
fi
VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest |
grep "tag_name" | grep "tag_name" |
awk '{print substr($2, 2, length($2)-3) }') awk '{print substr($2, 2, length($2)-3) }')
WVRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest | WVRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest |
grep "tag_name" | grep "tag_name" |
awk '{print substr($2, 2, length($2)-3) }') awk '{print substr($2, 2, length($2)-3) }')
UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \ UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 3 \
"1" "VaultWarden $VAULT" ON \ "1" "VaultWarden $VAULT" ON \
"2" "Web-Vault $WVRELEASE" OFF \ "2" "Web-Vault $WVRELEASE" OFF \
"3" "Show Admin Token" OFF \ "3" "Show Admin Token" 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
echo -e "\n ⚠ Ensure you set 4vCPU & 4096MiB RAM minimum!!! \n" echo -e "\n ⚠ Ensure you set 4vCPU & 4096MiB RAM minimum!!! \n"
msg_info "Stopping Vaultwarden" msg_info "Stopping Vaultwarden"
systemctl stop vaultwarden.service systemctl stop vaultwarden.service
msg_ok "Stopped Vaultwarden" msg_ok "Stopped Vaultwarden"
msg_info "Updating VaultWarden to $VAULT (Patience)" msg_info "Updating VaultWarden to $VAULT (Patience)"
cd ~ && rm -rf vaultwarden cd ~ && rm -rf vaultwarden
git clone https://github.com/dani-garcia/vaultwarden &>/dev/null git clone https://github.com/dani-garcia/vaultwarden &>/dev/null
cd vaultwarden cd vaultwarden
cargo build --features "sqlite,mysql,postgresql" --release &>/dev/null cargo build --features "sqlite,mysql,postgresql" --release &>/dev/null
DIR=/usr/bin/vaultwarden DIR=/usr/bin/vaultwarden
if [ -d "$DIR" ]; then if [ -d "$DIR" ]; then
cp target/release/vaultwarden /usr/bin/ cp target/release/vaultwarden /usr/bin/
else else
cp target/release/vaultwarden /opt/vaultwarden/bin/ cp target/release/vaultwarden /opt/vaultwarden/bin/
fi fi
msg_ok "Updated VaultWarden" msg_ok "Updated VaultWarden"
msg_info "Cleaning up" msg_info "Cleaning up"
cd ~ && rm -rf vaultwarden cd ~ && rm -rf vaultwarden
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting Vaultwarden" msg_info "Starting Vaultwarden"
systemctl start vaultwarden.service systemctl start vaultwarden.service
msg_ok "Started Vaultwarden" msg_ok "Started Vaultwarden"
msg_ok "$VAULT Update Successful" msg_ok "$VAULT Update Successful"
echo -e "\n ⚠ Ensure you set resources back to normal settings \n" echo -e "\n ⚠ Ensure you set resources back to normal settings \n"
exit; exit
fi fi
if [ "$UPD" == "2" ]; then if [ "$UPD" == "2" ]; then
msg_info "Stopping Vaultwarden" msg_info "Stopping Vaultwarden"
systemctl stop vaultwarden.service systemctl stop vaultwarden.service
msg_ok "Stopped Vaultwarden" msg_ok "Stopped Vaultwarden"
msg_info "Updating Web-Vault to $WVRELEASE" msg_info "Updating Web-Vault to $WVRELEASE"
curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$WVRELEASE/bw_web_$WVRELEASE.tar.gz &>/dev/null curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$WVRELEASE/bw_web_$WVRELEASE.tar.gz &>/dev/null
tar -zxf bw_web_$WVRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null tar -zxf bw_web_$WVRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null
msg_ok "Updated Web-Vault" msg_ok "Updated Web-Vault"
msg_info "Cleaning up" msg_info "Cleaning up"
rm bw_web_$WVRELEASE.tar.gz rm bw_web_$WVRELEASE.tar.gz
msg_ok "Cleaned" msg_ok "Cleaned"
msg_info "Starting Vaultwarden" msg_info "Starting Vaultwarden"
systemctl start vaultwarden.service systemctl start vaultwarden.service
msg_ok "Started Vaultwarden" msg_ok "Started Vaultwarden"
msg_ok "$WVRELEASE Update Successful" msg_ok "$WVRELEASE Update Successful"
exit; exit
fi fi
if [ "$UPD" == "3" ]; then if [ "$UPD" == "3" ]; then
DIR=/usr/bin/vaultwarden DIR=/usr/bin/vaultwarden
if [ -d "$DIR" ]; then if [ -d "$DIR" ]; then
cat /etc/vaultwarden.env | grep "ADMIN_TOKEN" cat /etc/vaultwarden.env | grep "ADMIN_TOKEN"
else else
cat /opt/vaultwarden/.env | grep "ADMIN_TOKEN" cat /opt/vaultwarden/.env | grep "ADMIN_TOKEN"
fi fi
exit exit
fi fi
} }
start start

@ -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"
_____ _ __ ___ __ _______ ____________ _____ _ __ ___ __ _______ ____________
/__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/ /__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/
@ -53,60 +53,78 @@ function default_settings() {
} }
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/zigbee2mqtt ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/zigbee2mqtt ]]; then
cd /opt/zigbee2mqtt msg_error "No ${APP} Installation Found!"
exit
fi
cd /opt/zigbee2mqtt
stop_zigbee2mqtt() { stop_zigbee2mqtt() {
if which systemctl 2> /dev/null > /dev/null; then if which systemctl 2>/dev/null >/dev/null; then
echo "Shutting down Zigbee2MQTT..." echo "Shutting down Zigbee2MQTT..."
sudo systemctl stop zigbee2mqtt sudo systemctl stop zigbee2mqtt
else else
echo "Skipped stopping Zigbee2MQTT, no systemctl found" echo "Skipped stopping Zigbee2MQTT, no systemctl found"
fi fi
} }
start_zigbee2mqtt() { start_zigbee2mqtt() {
if which systemctl 2> /dev/null > /dev/null; then if which systemctl 2>/dev/null >/dev/null; then
echo "Starting Zigbee2MQTT..." echo "Starting Zigbee2MQTT..."
sudo systemctl start zigbee2mqtt sudo systemctl start zigbee2mqtt
else else
echo "Skipped starting Zigbee2MQTT, no systemctl found" echo "Skipped starting Zigbee2MQTT, no systemctl found"
fi fi
} }
set -e set -e
if [ -d data-backup ]; then if [ -d data-backup ]; then
echo "ERROR: Backup directory exists. May be previous restoring was failed?" echo "ERROR: Backup directory exists. May be previous restoring was failed?"
echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later." echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later."
echo "2. Manually delete 'data-backup' dir and try again." echo "2. Manually delete 'data-backup' dir and try again."
exit 1 exit 1
fi fi
stop_zigbee2mqtt stop_zigbee2mqtt
echo "Generating a backup of the configuration..." echo "Generating a backup of the configuration..."
cp -R data data-backup || { echo "Failed to create backup."; exit 1; } cp -R data data-backup || {
echo "Failed to create backup."
exit 1
}
echo "Initiating update" echo "Initiating update"
if ! git pull; then if ! git pull; then
echo "Update failed, temporarily storing changes and trying again." echo "Update failed, temporarily storing changes and trying again."
git stash && git pull || (echo "Update failed even after storing changes. Aborting."; exit 1) git stash && git pull || (
fi echo "Update failed even after storing changes. Aborting."
exit 1
)
fi
echo "Acquiring necessary components..." echo "Acquiring necessary components..."
npm ci || { echo "Failed to install necessary components."; exit 1; } npm ci || {
echo "Failed to install necessary components."
exit 1
}
echo "Restoring configuration..." echo "Restoring configuration..."
cp -R data-backup/* data || { echo "Failed to restore configuration."; exit 1; } cp -R data-backup/* data || {
echo "Failed to restore configuration."
exit 1
}
rm -rf data-backup || { echo "Failed to remove backup directory."; exit 1; } rm -rf data-backup || {
echo "Failed to remove backup directory."
exit 1
}
start_zigbee2mqtt start_zigbee2mqtt
echo "Done!" echo "Done!"
exit exit
} }
start start

@ -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"
_____ _______ __ ______ _____ _______ __ ______
/__ /_ ______ __ _____ / / ___/ / / / / _/ /__ /_ ______ __ _____ / / ___/ / / / / _/
@ -52,28 +52,31 @@ function default_settings() {
} }
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/zwave-js-ui ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/zwave-js-ui ]]; then
RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') msg_error "No ${APP} Installation Found!"
msg_info "Stopping Z-wave JS UI" exit
systemctl stop zwave-js-ui.service fi
msg_ok "Stopped Z-wave JS UI" RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
msg_info "Stopping Z-wave JS UI"
systemctl stop zwave-js-ui.service
msg_ok "Stopped Z-wave JS UI"
msg_info "Updating Z-wave JS UI" msg_info "Updating Z-wave JS UI"
wget https://github.com/zwave-js/zwave-js-ui/releases/download/${RELEASE}/zwave-js-ui-${RELEASE}-linux.zip &>/dev/null wget https://github.com/zwave-js/zwave-js-ui/releases/download/${RELEASE}/zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
\cp -R zwave-js-ui-linux /opt/zwave-js-ui \cp -R zwave-js-ui-linux /opt/zwave-js-ui
msg_ok "Updated Z-wave JS UI" msg_ok "Updated Z-wave JS UI"
msg_info "Starting Z-wave JS UI" msg_info "Starting Z-wave JS UI"
systemctl enable --now zwave-js-ui.service systemctl enable --now zwave-js-ui.service
msg_ok "Started Z-wave JS UI" msg_ok "Started Z-wave JS UI"
msg_info "Cleanup" msg_info "Cleanup"
rm -rf zwave-js-ui-${RELEASE}-linux.zip zwave-js-ui-linux store rm -rf zwave-js-ui-${RELEASE}-linux.zip zwave-js-ui-linux store
msg_ok "Cleaned" msg_ok "Cleaned"
msg_ok "Updated Successfully!\n" msg_ok "Updated Successfully!\n"
exit exit
} }
start start

Loading…
Cancel
Save