mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-15 09:43:25 +01:00
* Simplify Alpine update scripts to run upgrade Remove interactive whiptail menus, loops and newt dependency checks from ct/alpine-docker.sh, ct/alpine-zigbee2mqtt.sh, and ct/alpine.sh. Each update_script now simply calls header_info, runs $STD apk -U upgrade, displays a success message and exits, simplifying and automating the update flow. * feat(update-scripts): replace whiptail with msg_menu for unattended updates Remove all whiptail dialogs from ct update_script() functions and replace with msg_menu() - a lightweight read-based menu that supports: - PHS_SILENT=1: auto-selects first (default) option for unattended mode - Interactive: numbered menu with 10s timeout and default fallback Converted scripts (whiptail menu → msg_menu): - plex.sh, npmplus.sh, cronicle.sh, meilisearch.sh, node-red.sh - homeassistant.sh, podman-homeassistant.sh - vaultwarden.sh, alpine-vaultwarden.sh - loki.sh, alpine-loki.sh - alpine-grafana.sh, alpine-redis.sh, alpine-valkey.sh - alpine-nextcloud.sh Simplified scripts (removed unnecessary whiptail for single-action updates): - alpine.sh, alpine-docker.sh, alpine-zigbee2mqtt.sh Special handling: - gitea-mirror.sh: replaced yesno/msgbox with read -rp confirmations, exit 75 in silent mode for major version upgrades requiring interaction - vaultwarden.sh/alpine-vaultwarden.sh: passwordbox replaced with read -r -s -p, skipped in silent mode with warning - nginxproxymanager.sh: exit 1 → exit 75 for disabled script Infrastructure: - Added msg_menu() helper to misc/build.func - Added exit code 75 handling in update-apps.sh (skip, not fail) Closes #11620 * refactor(update-scripts): remove menus where sequential updates suffice - alpine-nextcloud: add apk upgrade as the update action (was missing) - meilisearch: run meilisearch + UI updates sequentially (like bar-assistant) - npmplus: run alpine upgrade + docker pull sequentially, no menu - vaultwarden: update VaultWarden + Web-Vault sequentially, remove admin token option (interactive-only, not suitable for unattended updates) - alpine-vaultwarden: just run apk upgrade, remove admin token menu
118 lines
3.7 KiB
Bash
118 lines
3.7 KiB
Bash
#!/usr/bin/env bash
|
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/dani-garcia/vaultwarden
|
|
|
|
APP="Vaultwarden"
|
|
var_tags="${var_tags:-password-manager}"
|
|
var_cpu="${var_cpu:-4}"
|
|
var_ram="${var_ram:-6144}"
|
|
var_disk="${var_disk:-20}"
|
|
var_os="${var_os:-debian}"
|
|
var_version="${var_version:-13}"
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
function update_script() {
|
|
header_info
|
|
check_container_storage
|
|
check_container_resources
|
|
if [[ ! -f /etc/systemd/system/vaultwarden.service ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
VAULT=$(get_latest_github_release "dani-garcia/vaultwarden")
|
|
WVRELEASE=$(get_latest_github_release "dani-garcia/bw_web_builds")
|
|
|
|
UPD=$(msg_menu "Vaultwarden Update Options" \
|
|
"1" "Update VaultWarden + Web-Vault" \
|
|
"2" "Set Admin Token")
|
|
|
|
if [ "$UPD" == "1" ]; then
|
|
if check_for_gh_release "vaultwarden" "dani-garcia/vaultwarden"; then
|
|
msg_info "Stopping Service"
|
|
systemctl stop vaultwarden
|
|
msg_ok "Stopped Service"
|
|
|
|
fetch_and_deploy_gh_release "vaultwarden" "dani-garcia/vaultwarden" "tarball" "latest" "/tmp/vaultwarden-src"
|
|
|
|
msg_info "Updating VaultWarden to $VAULT (Patience)"
|
|
cd /tmp/vaultwarden-src
|
|
$STD cargo build --features "sqlite,mysql,postgresql" --release
|
|
if [[ -f /usr/bin/vaultwarden ]]; then
|
|
cp target/release/vaultwarden /usr/bin/
|
|
else
|
|
cp target/release/vaultwarden /opt/vaultwarden/bin/
|
|
fi
|
|
cd ~ && rm -rf /tmp/vaultwarden-src
|
|
msg_ok "Updated VaultWarden to ${VAULT}"
|
|
|
|
msg_info "Starting Service"
|
|
systemctl start vaultwarden
|
|
msg_ok "Started Service"
|
|
else
|
|
msg_ok "VaultWarden is already up-to-date"
|
|
fi
|
|
|
|
if check_for_gh_release "vaultwarden_webvault" "dani-garcia/bw_web_builds"; then
|
|
msg_info "Stopping Service"
|
|
systemctl stop vaultwarden
|
|
msg_ok "Stopped Service"
|
|
|
|
msg_info "Updating Web-Vault to $WVRELEASE"
|
|
rm -rf /opt/vaultwarden/web-vault
|
|
mkdir -p /opt/vaultwarden/web-vault
|
|
|
|
fetch_and_deploy_gh_release "vaultwarden_webvault" "dani-garcia/bw_web_builds" "prebuild" "latest" "/opt/vaultwarden/web-vault" "bw_web_*.tar.gz"
|
|
|
|
chown -R root:root /opt/vaultwarden/web-vault/
|
|
msg_ok "Updated Web-Vault to ${WVRELEASE}"
|
|
|
|
msg_info "Starting Service"
|
|
systemctl start vaultwarden
|
|
msg_ok "Started Service"
|
|
else
|
|
msg_ok "Web-Vault is already up-to-date"
|
|
fi
|
|
|
|
msg_ok "Updated successfully!"
|
|
exit
|
|
fi
|
|
|
|
if [ "$UPD" == "2" ]; then
|
|
if [[ "${PHS_SILENT:-0}" == "1" ]]; then
|
|
msg_warn "Set Admin Token requires interactive mode, skipping."
|
|
exit
|
|
fi
|
|
read -r -s -p "Set the ADMIN_TOKEN: " NEWTOKEN
|
|
echo ""
|
|
if [[ -n "$NEWTOKEN" ]]; then
|
|
ensure_dependencies argon2
|
|
TOKEN=$(echo -n "${NEWTOKEN}" | argon2 "$(openssl rand -base64 32)" -t 2 -m 16 -p 4 -l 64 -e)
|
|
sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env
|
|
if [[ -f /opt/vaultwarden/data/config.json ]]; then
|
|
sed -i "s|\"admin_token\":.*|\"admin_token\": \"${TOKEN}\"|" /opt/vaultwarden/data/config.json
|
|
fi
|
|
systemctl restart vaultwarden
|
|
msg_ok "Admin token updated"
|
|
fi
|
|
exit
|
|
fi
|
|
}
|
|
|
|
start
|
|
build_container
|
|
description
|
|
|
|
msg_ok "Completed successfully!\n"
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
|
echo -e "${TAB}${GATEWAY}${BGN}https://${IP}:8000${CL}"
|