Compare commits

..

1 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) 6886d6127b paperless: change update abort message (endless spinner) 2026-08-06 07:57:10 +02:00
4 changed files with 56 additions and 28 deletions
+14
View File
@@ -42,6 +42,20 @@ function update_script() {
echo -e "${TAB}${TAB}${GN}bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)\"${CL}" echo -e "${TAB}${TAB}${GN}bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)\"${CL}"
fi fi
if docker ps -a --format '{{.Names}}' | grep -q '^portainer_agent$'; then
msg_info "Updating Portainer Agent"
$STD docker pull portainer/agent:latest
$STD docker stop portainer_agent
$STD docker rm portainer_agent
$STD docker run -d \
-p 9001:9001 \
--name=portainer_agent \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/volumes:/var/lib/docker/volumes \
portainer/agent
msg_ok "Updated Portainer Agent"
fi
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
exit exit
} }
+1 -1
View File
@@ -65,7 +65,7 @@ function update_script() {
read -rp "Do you want to continue with the update? (y/N): " MIGRATE read -rp "Do you want to continue with the update? (y/N): " MIGRATE
echo echo
if [[ ! "$MIGRATE" =~ ^[Yy]$ ]]; then if [[ ! "$MIGRATE" =~ ^[Yy]$ ]]; then
msg_info "Update aborted. Decrypt all documents before upgrading to v3." msg_custom "⚠️" "Update aborted. Decrypt all documents before upgrading to v3."
exit 0 exit 0
fi fi
fi fi
+32 -5
View File
@@ -4801,8 +4801,8 @@ EOF
# Container Update Check # Container Update Check
# - Skipped entirely when running unattended / non-interactive # - Skipped entirely when running unattended / non-interactive
# - Lists containers with a newer image available and the command to update # - Compose-managed containers: offered via Y/N → docker compose pull + up -d
# them; does not pull/recreate anything itself # - Standalone containers: offered via Y/N → image pull only (no stop/rm)
if [ "$docker_installed" = true ] && ! _docker_is_noninteractive; then if [ "$docker_installed" = true ] && ! _docker_is_noninteractive; then
msg_info "Checking for container updates" msg_info "Checking for container updates"
@@ -4840,14 +4840,41 @@ EOF
if [[ ${#compose_updates[@]} -eq 0 && ${#standalone_updates[@]} -eq 0 ]]; then if [[ ${#compose_updates[@]} -eq 0 && ${#standalone_updates[@]} -eq 0 ]]; then
msg_ok "All containers are up-to-date" msg_ok "All containers are up-to-date"
else else
msg_warn "Updates available (not applied automatically):" local reply
for entry in "${compose_updates[@]}"; do for entry in "${compose_updates[@]}"; do
IFS='|' read -r name image compose_workdir compose_service <<<"$entry" IFS='|' read -r name image compose_workdir compose_service <<<"$entry"
echo -e "${TAB3}${name} (${image}) — update via: cd ${compose_workdir} && docker compose pull ${compose_service} && docker compose up -d ${compose_service}" reply=""
if read -r -t 60 -p "${TAB3}Update ${name} (${image}) via Compose? <y/N> (auto-no in 60s): " reply </dev/tty; then
echo ""
else
echo ""
fi
if [[ "${reply,,}" =~ ^(y|yes)$ ]]; then
msg_info "Updating $name"
if (cd "$compose_workdir" && $STD docker compose pull "$compose_service" && $STD docker compose up -d "$compose_service"); then
msg_ok "Updated $name"
else
msg_warn "Could not update $name — try manually in $compose_workdir"
fi
fi
done done
for entry in "${standalone_updates[@]}"; do for entry in "${standalone_updates[@]}"; do
IFS='|' read -r name image <<<"$entry" IFS='|' read -r name image <<<"$entry"
echo -e "${TAB3}${name} (${image}) — update via: docker pull ${image} && docker restart ${name}" reply=""
if read -r -t 60 -p "${TAB3}Pull new image for ${name} (${image})? <y/N> (auto-no in 60s): " reply </dev/tty; then
echo ""
else
echo ""
fi
if [[ "${reply,,}" =~ ^(y|yes)$ ]]; then
msg_info "Pulling new image for $name"
if $STD docker pull "$image"; then
msg_ok "New image available for $name — recreate the container to apply the update"
else
msg_warn "Failed to pull image for $name"
fi
fi
done done
fi fi
fi fi
+9 -22
View File
@@ -49,22 +49,6 @@ function uninstall() {
msg_ok "${APP} has been uninstalled" msg_ok "${APP} has been uninstalled"
} }
# ==============================================================================
# UPDATE SCRIPT HELPER
# ==============================================================================
function ensure_update_script() {
[[ -f /usr/local/bin/update_portainer ]] && return 0
msg_info "Creating update script"
cat <<'UPDATEEOF' >/usr/local/bin/update_portainer
#!/usr/bin/env bash
# Portainer Update Script
type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)"
UPDATEEOF
chmod +x /usr/local/bin/update_portainer
msg_ok "Created update script (/usr/local/bin/update_portainer)"
}
# ============================================================================== # ==============================================================================
# UPDATE # UPDATE
# ============================================================================== # ==============================================================================
@@ -78,8 +62,6 @@ function update() {
$STD docker compose up -d --remove-orphans $STD docker compose up -d --remove-orphans
msg_ok "Restarted ${APP}" msg_ok "Restarted ${APP}"
ensure_update_script
msg_ok "Updated successfully" msg_ok "Updated successfully"
exit exit
} }
@@ -133,7 +115,15 @@ function install() {
$STD docker compose up -d $STD docker compose up -d
msg_ok "Started ${APP}" msg_ok "Started ${APP}"
ensure_update_script # Create update script
msg_info "Creating update script"
cat <<'UPDATEEOF' >/usr/local/bin/update_portainer
#!/usr/bin/env bash
# Portainer Update Script
type=update bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/portainer.sh)"
UPDATEEOF
chmod +x /usr/local/bin/update_portainer
msg_ok "Created update script (/usr/local/bin/update_portainer)"
echo "" echo ""
msg_ok "${APP} is reachable at: ${BL}https://${LOCAL_IP}:${DEFAULT_PORT}${CL}" msg_ok "${APP} is reachable at: ${BL}https://${LOCAL_IP}:${DEFAULT_PORT}${CL}"
@@ -160,9 +150,6 @@ fi
header_info header_info
get_lxc_ip get_lxc_ip
check_docker
check_existing_container
# Check if already installed # Check if already installed
if [[ -f "$COMPOSE_FILE" ]]; then if [[ -f "$COMPOSE_FILE" ]]; then
msg_warn "${APP} is already installed." msg_warn "${APP} is already installed."