diff --git a/ct/alpine-komodo.sh b/ct/alpine-komodo.sh index bb591091d..7a3a6aa01 100644 --- a/ct/alpine-komodo.sh +++ b/ct/alpine-komodo.sh @@ -34,8 +34,7 @@ function update_script() { echo -e "${INFO}${YW}This is a one-time migration. After this, you can update ${APP} anytime with:${CL}" echo -e "${TAB}${TAB}${GN}update_komodo${CL} or ${GN}bash <(curl -fsSL ${ADDON_SCRIPT})${CL}" echo "" - read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM - if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then + if ! prompt_confirm "${TAB}Migrate update function now?" "n"; then msg_warn "Migration skipped. The old update will continue to work for now." msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates." msg_warn "Please migrate to the addon script to receive Komodo v2." diff --git a/ct/bichon.sh b/ct/bichon.sh index 88a4e7834..fc1be6bbd 100644 --- a/ct/bichon.sh +++ b/ct/bichon.sh @@ -50,6 +50,10 @@ function update_script() { if [[ -n "$STORAGE_KB" && -n "$FREE_KB" && "$FREE_KB" -lt "$STORAGE_KB" ]]; then echo -e "\n${RD}Warning: migration needs about $((STORAGE_KB / 1024))MB, only $((FREE_KB / 1024))MB free.${CL}" echo -e "${RD}The new bichon-blob store is written alongside the existing fjall data.${CL}" + if is_unattended; then + msg_warn "Not enough free space for the migration - skipping update, requires an interactive run" + exit 75 + fi read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed if [[ ! $proceed =~ ^[Yy]$ ]]; then msg_error "Update cancelled by user." diff --git a/ct/cockpit.sh b/ct/cockpit.sh index 4bdda9479..e96cb3aa8 100644 --- a/ct/cockpit.sh +++ b/ct/cockpit.sh @@ -36,8 +36,7 @@ function update_script() { msg_ok "Updated ${APP} LXC" if [[ ! -f /etc/apt/sources.list.d/45drives.sources ]]; then - [[ "$(arch_resolve)" == "arm64" ]] || read -r -p "Would you like to install 45Drives' cockpit-file-sharing, cockpit-identities, and cockpit-navigator now? " prompt - if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then + if [[ "$(arch_resolve)" != "arm64" ]] && prompt_confirm "Would you like to install 45Drives' cockpit-file-sharing, cockpit-identities, and cockpit-navigator now?" "n"; then msg_info "Installing 45Drives' cockpit extensions" setup_deb822_repo "45drives" \ "https://repo.45drives.com/key/gpg.asc" \ diff --git a/ct/dockge.sh b/ct/dockge.sh index 04433bc54..1ca975e8e 100644 --- a/ct/dockge.sh +++ b/ct/dockge.sh @@ -38,8 +38,7 @@ function update_script() { echo -e "${INFO}${YW}This is a one-time migration. After this, you can update ${APP} anytime with:${CL}" echo -e "${TAB}${TAB}${GN}update_dockge${CL} or ${GN}bash <(curl -fsSL ${ADDON_SCRIPT})${CL}" echo "" - read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM - if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then + if ! prompt_confirm "${TAB}Migrate update function now?" "n"; then msg_warn "Migration skipped. The old update will continue to work for now." msg_info "Updating ${APP} (legacy)" cd /opt/dockge diff --git a/ct/dokploy.sh b/ct/dokploy.sh index ceef5d112..06c980fea 100644 --- a/ct/dokploy.sh +++ b/ct/dokploy.sh @@ -38,8 +38,7 @@ function update_script() { echo -e "${INFO}${YW}This is a one-time migration. After this, you can update ${APP} anytime with:${CL}" echo -e "${TAB}${TAB}${GN}update_dokploy${CL} or ${GN}bash <(curl -fsSL ${ADDON_SCRIPT})${CL}" echo "" - read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM - if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then + if ! prompt_confirm "${TAB}Migrate update function now?" "n"; then msg_warn "Migration skipped. The old update will continue to work for now." msg_info "Updating ${APP} (legacy)" curl -sSL https://dokploy.com/install.sh | $STD bash -s update diff --git a/ct/gitea-mirror.sh b/ct/gitea-mirror.sh index 780523f80..e113536a0 100644 --- a/ct/gitea-mirror.sh +++ b/ct/gitea-mirror.sh @@ -33,7 +33,7 @@ function update_script() { APP_VERSION=$(grep -o '"version": *"[^"]*"' /opt/gitea-mirror/package.json | cut -d'"' -f4) if [[ $APP_VERSION =~ ^2\. ]]; then - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then msg_warn "Version $APP_VERSION detected. Major version upgrade requires interactive confirmation, skipping." exit 75 fi diff --git a/ct/jellyseerr.sh b/ct/jellyseerr.sh index c6ea3cb08..25bbede03 100644 --- a/ct/jellyseerr.sh +++ b/ct/jellyseerr.sh @@ -39,7 +39,7 @@ function update_script() { echo "Seerr is the new unified Jellyseerr and Overseerr." echo "More info: https://docs.seerr.dev/blog/seerr-release" echo - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then msg_warn "Seerr migration detected - skipping update, requires an interactive run" exit 75 fi diff --git a/ct/komodo.sh b/ct/komodo.sh index 0c98a6771..81bc69be8 100644 --- a/ct/komodo.sh +++ b/ct/komodo.sh @@ -38,8 +38,7 @@ function update_script() { msg_custom "ℹ️" "${YW}" "This is a one-time migration. After this, you can update ${APP} anytime with:" echo -e "${TAB}${TAB}${GN}update_komodo${CL} or ${GN}bash <(curl -fsSL ${ADDON_SCRIPT})${CL}" echo "" - read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM - if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then + if ! prompt_confirm "${TAB}Migrate update function now?" "n"; then msg_warn "Migration skipped. The old update will continue to work for now." msg_warn "⚠️ Komodo v2 uses :2 image tags. The :latest tag is deprecated and will not receive v2 updates." msg_warn "Please migrate to the addon script to receive Komodo v2." diff --git a/ct/overseerr.sh b/ct/overseerr.sh index 2d9d7b0e2..6d31c71a5 100644 --- a/ct/overseerr.sh +++ b/ct/overseerr.sh @@ -38,7 +38,7 @@ function update_script() { echo "Seerr is the new unified Jellyseerr and Overseerr." echo "More info: https://docs.seerr.dev/blog/seerr-release" echo - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then msg_warn "Seerr migration detected - skipping update, requires an interactive run" exit 75 fi diff --git a/ct/paperless-ngx.sh b/ct/paperless-ngx.sh index b9f6eca67..37b9af771 100644 --- a/ct/paperless-ngx.sh +++ b/ct/paperless-ngx.sh @@ -63,7 +63,7 @@ function update_script() { echo -e "${GATEWAY}${BGN}https://docs.paperless-ngx.com/migration-v3/#encryption-support${CL}" msg_warn "Before continuing make sure that you do not use encryption or have decrypted all documents." echo "" - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then msg_warn "Paperless-ngx v3 migration detected - skipping update, requires an interactive run" exit 75 fi @@ -75,7 +75,7 @@ function update_script() { fi fi - if [[ "${PHS_SILENT:-0}" == "1" ]] && ! grep -q "uv run" /etc/systemd/system/paperless-webserver.service; then + if is_unattended && ! grep -q "uv run" /etc/systemd/system/paperless-webserver.service; then msg_warn "Paperless-ngx uv migration detected - skipping update, requires an interactive run" exit 75 fi diff --git a/ct/runtipi.sh b/ct/runtipi.sh index b0f3c69f3..e707d1839 100644 --- a/ct/runtipi.sh +++ b/ct/runtipi.sh @@ -38,8 +38,7 @@ function update_script() { echo -e "${INFO}${YW}This is a one-time migration. After this, you can update ${APP} anytime with:${CL}" echo -e "${TAB}${TAB}${GN}update_runtipi${CL} or ${GN}bash <(curl -fsSL ${ADDON_SCRIPT})${CL}" echo "" - read -r -p "${TAB}Migrate update function now? [y/N]: " CONFIRM - if [[ ! "${CONFIRM,,}" =~ ^(y|yes)$ ]]; then + if ! prompt_confirm "${TAB}Migrate update function now?" "n"; then msg_warn "Migration skipped. The old update will continue to work for now." msg_info "Updating ${APP} (legacy)" cd /opt/runtipi && ./runtipi-cli update latest diff --git a/ct/semaphore.sh b/ct/semaphore.sh index 78beee33b..e2e783e5f 100644 --- a/ct/semaphore.sh +++ b/ct/semaphore.sh @@ -38,6 +38,10 @@ function update_script() { msg_warn "WARNING: Due to bugs with BoltDB database, update script will move your application" msg_warn "to use SQLite database instead. Make sure you have a backup of your data!" echo "" + if is_unattended; then + msg_warn "BoltDB to SQLite migration detected - skipping update, requires an interactive run" + exit 75 + fi read -r -p "${TAB3}Do you want to continue? (y/N): " CONFIRM if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then exit 0 diff --git a/ct/termix.sh b/ct/termix.sh index 0e8d595e0..a2950830c 100644 --- a/ct/termix.sh +++ b/ct/termix.sh @@ -224,8 +224,8 @@ EOF msg_custom "💾" "Your current config will be backed up to nginx.conf.bak" msg_custom "⚠️ " "Note: Custom modifications (reverse proxy, SSL) will be overwritten!" echo "" - read -rp "${TAB3}Update Nginx configuration? [Y/n]: " REPLY - if [[ "${REPLY,,}" =~ ^(y|yes|)$ ]]; then + # Unattended keeps the current file: the new one drops reverse-proxy and SSL edits. + if ! is_unattended && prompt_confirm "${TAB3}Update Nginx configuration?" "y"; then msg_info "Updating Nginx Configuration" cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak curl -fsSL "https://raw.githubusercontent.com/Termix-SSH/Termix/main/docker/nginx.conf" -o /etc/nginx/nginx.conf diff --git a/ct/vikunja.sh b/ct/vikunja.sh index 1d4aeab4e..0180b9179 100644 --- a/ct/vikunja.sh +++ b/ct/vikunja.sh @@ -36,7 +36,7 @@ function update_script() { msg_warn "This requires MANUAL config changes in /etc/vikunja/config.yml." msg_warn "See: https://vikunja.io/changelog/whats-new-in-vikunja-1.0.0/#config-changes" - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then msg_warn "Vikunja 1.0 config migration detected - skipping update, requires an interactive run" exit 75 fi @@ -64,7 +64,7 @@ function update_script() { echo -e "${TAB}${YW}How do you want to handle /etc/vikunja/config.yml?${CL}" echo -e "${TAB} 1) Keep your current config" echo -e "${TAB} 2) Install the new package maintainer's config" - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then CONFIG_CHOICE="1" else read -rp " Choose [1/2] (default: 1): " -t 60 CONFIG_CHOICE || CONFIG_CHOICE="1" diff --git a/ct/zabbix.sh b/ct/zabbix.sh index 7d7202f49..910b5fd94 100644 --- a/ct/zabbix.sh +++ b/ct/zabbix.sh @@ -49,7 +49,7 @@ function update_script() { ZABBIX_SERIES="$(dpkg-query -W -f='${Version}' zabbix-release 2>/dev/null || true)" ZABBIX_SERIES="${ZABBIX_SERIES#*:}" ZABBIX_SERIES="${ZABBIX_SERIES%%[!0-9.]*}" - if [[ "${PHS_SILENT:-0}" == "1" ]]; then + if is_unattended; then if [[ ! "$ZABBIX_SERIES" =~ ^[0-9]+\.[0-9]+$ ]]; then msg_warn "Could not detect the installed Zabbix series - skipping update, requires an interactive run" exit 75