Merge branch 'main' of https://github.com/community-scripts/ProxmoxVED
This commit is contained in:
commit
530a197b49
6
ct/headers/alpine-komodo
Normal file
6
ct/headers/alpine-komodo
Normal file
@ -0,0 +1,6 @@
|
||||
___ __ _ __ __ __
|
||||
/ | / /___ (_)___ ___ / //_/___ ____ ___ ____ ____/ /___
|
||||
/ /| | / / __ \/ / __ \/ _ \______/ ,< / __ \/ __ `__ \/ __ \/ __ / __ \
|
||||
/ ___ |/ / /_/ / / / / / __/_____/ /| / /_/ / / / / / / /_/ / /_/ / /_/ /
|
||||
/_/ |_/_/ .___/_/_/ /_/\___/ /_/ |_\____/_/ /_/ /_/\____/\__,_/\____/
|
||||
/_/
|
6
ct/headers/alpine-tinyauth
Normal file
6
ct/headers/alpine-tinyauth
Normal file
@ -0,0 +1,6 @@
|
||||
___ __ _ _______ __ __
|
||||
/ | / /___ (_)___ ___ /_ __(_)___ __ ______ ___ __/ /_/ /_
|
||||
/ /| | / / __ \/ / __ \/ _ \______/ / / / __ \/ / / / __ `/ / / / __/ __ \
|
||||
/ ___ |/ / /_/ / / / / / __/_____/ / / / / / / /_/ / /_/ / /_/ / /_/ / / /
|
||||
/_/ |_/_/ .___/_/_/ /_/\___/ /_/ /_/_/ /_/\__, /\__,_/\__,_/\__/_/ /_/
|
||||
/_/ /____/
|
@ -49,6 +49,7 @@ function update_script() {
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
cd /opt
|
||||
rm -rf /opt/vikunja/vikunja
|
||||
rm -rf "/opt/$FILENAME"
|
||||
curl -fsSL "https://dl.vikunja.io/vikunja/$RELEASE/$FILENAME" -o $(basename "https://dl.vikunja.io/vikunja/$RELEASE/$FILENAME")
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
$STD dpkg -i $FILENAME
|
||||
|
@ -1,4 +1,159 @@
|
||||
[
|
||||
{
|
||||
"name": "steveiliop56/tinyauth",
|
||||
"version": "v3.4.1",
|
||||
"date": "2025-06-11T07:53:44Z"
|
||||
},
|
||||
{
|
||||
"name": "slskd/slskd",
|
||||
"version": "0.23.1",
|
||||
"date": "2025-07-06T23:57:52Z"
|
||||
},
|
||||
{
|
||||
"name": "pelican-dev/panel",
|
||||
"version": "v1.0.0-beta22",
|
||||
"date": "2025-07-06T21:16:00Z"
|
||||
},
|
||||
{
|
||||
"name": "pelican-dev/wings",
|
||||
"version": "v1.0.0-beta14",
|
||||
"date": "2025-07-06T21:07:07Z"
|
||||
},
|
||||
{
|
||||
"name": "pocket-id/pocket-id",
|
||||
"version": "v1.6.1",
|
||||
"date": "2025-07-06T20:59:34Z"
|
||||
},
|
||||
{
|
||||
"name": "Luligu/matterbridge",
|
||||
"version": "3.1.2",
|
||||
"date": "2025-07-06T20:55:23Z"
|
||||
},
|
||||
{
|
||||
"name": "bluenviron/mediamtx",
|
||||
"version": "v1.13.0",
|
||||
"date": "2025-07-06T19:23:55Z"
|
||||
},
|
||||
{
|
||||
"name": "syncthing/syncthing",
|
||||
"version": "v1.30.0",
|
||||
"date": "2025-07-01T11:29:11Z"
|
||||
},
|
||||
{
|
||||
"name": "traccar/traccar",
|
||||
"version": "v6.8.0",
|
||||
"date": "2025-07-06T18:19:05Z"
|
||||
},
|
||||
{
|
||||
"name": "firefly-iii/firefly-iii",
|
||||
"version": "v6.2.20",
|
||||
"date": "2025-07-02T04:03:37Z"
|
||||
},
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.23.0",
|
||||
"date": "2025-07-06T16:01:58Z"
|
||||
},
|
||||
{
|
||||
"name": "TandoorRecipes/recipes",
|
||||
"version": "1.5.35",
|
||||
"date": "2025-06-22T08:30:10Z"
|
||||
},
|
||||
{
|
||||
"name": "Part-DB/Part-DB-server",
|
||||
"version": "v1.17.2",
|
||||
"date": "2025-07-06T12:21:52Z"
|
||||
},
|
||||
{
|
||||
"name": "redis/redis",
|
||||
"version": "8.0.3",
|
||||
"date": "2025-07-06T12:19:24Z"
|
||||
},
|
||||
{
|
||||
"name": "Jackett/Jackett",
|
||||
"version": "v0.22.2123",
|
||||
"date": "2025-07-06T06:01:32Z"
|
||||
},
|
||||
{
|
||||
"name": "fallenbagel/jellyseerr",
|
||||
"version": "preview-OIDC",
|
||||
"date": "2025-07-06T00:51:06Z"
|
||||
},
|
||||
{
|
||||
"name": "hyperion-project/hyperion.ng",
|
||||
"version": "2.1.1",
|
||||
"date": "2025-06-14T17:45:06Z"
|
||||
},
|
||||
{
|
||||
"name": "Kareadita/Kavita",
|
||||
"version": "v0.8.7",
|
||||
"date": "2025-07-05T20:08:58Z"
|
||||
},
|
||||
{
|
||||
"name": "cross-seed/cross-seed",
|
||||
"version": "v6.12.7",
|
||||
"date": "2025-06-18T03:44:24Z"
|
||||
},
|
||||
{
|
||||
"name": "nicolargo/glances",
|
||||
"version": "v4.3.2",
|
||||
"date": "2025-07-05T16:00:15Z"
|
||||
},
|
||||
{
|
||||
"name": "runtipi/runtipi",
|
||||
"version": "v4.3.0",
|
||||
"date": "2025-07-05T12:14:52Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "fumadocs-openapi@9.0.18",
|
||||
"date": "2025-07-05T09:36:45Z"
|
||||
},
|
||||
{
|
||||
"name": "theonedev/onedev",
|
||||
"version": "v11.11.4",
|
||||
"date": "2025-07-05T09:23:25Z"
|
||||
},
|
||||
{
|
||||
"name": "Paymenter/Paymenter",
|
||||
"version": "v1.2.0",
|
||||
"date": "2025-07-05T08:58:05Z"
|
||||
},
|
||||
{
|
||||
"name": "linkwarden/linkwarden",
|
||||
"version": "v2.11.3",
|
||||
"date": "2025-07-05T04:34:46Z"
|
||||
},
|
||||
{
|
||||
"name": "home-assistant/core",
|
||||
"version": "2025.7.1",
|
||||
"date": "2025-07-04T20:02:52Z"
|
||||
},
|
||||
{
|
||||
"name": "homarr-labs/homarr",
|
||||
"version": "v1.27.0",
|
||||
"date": "2025-07-04T19:16:16Z"
|
||||
},
|
||||
{
|
||||
"name": "zitadel/zitadel",
|
||||
"version": "v3.3.0",
|
||||
"date": "2025-06-12T06:54:48Z"
|
||||
},
|
||||
{
|
||||
"name": "bunkerity/bunkerweb",
|
||||
"version": "v1.6.2",
|
||||
"date": "2025-07-04T15:21:18Z"
|
||||
},
|
||||
{
|
||||
"name": "kimai/kimai",
|
||||
"version": "2.37.0",
|
||||
"date": "2025-07-04T14:49:43Z"
|
||||
},
|
||||
{
|
||||
"name": "keycloak/keycloak",
|
||||
"version": "26.3.0",
|
||||
"date": "2025-07-02T12:26:44Z"
|
||||
},
|
||||
{
|
||||
"name": "Graylog2/graylog2-server",
|
||||
"version": "6.3.1",
|
||||
@ -9,46 +164,16 @@
|
||||
"version": "preview-v0.1",
|
||||
"date": "2025-06-27T14:35:47Z"
|
||||
},
|
||||
{
|
||||
"name": "theonedev/onedev",
|
||||
"version": "v11.11.3",
|
||||
"date": "2025-07-04T09:04:46Z"
|
||||
},
|
||||
{
|
||||
"name": "nzbgetcom/nzbget",
|
||||
"version": "v25.2",
|
||||
"date": "2025-07-04T08:21:42Z"
|
||||
},
|
||||
{
|
||||
"name": "bunkerity/bunkerweb",
|
||||
"version": "v1.6.2",
|
||||
"date": "2025-07-04T08:43:44Z"
|
||||
},
|
||||
{
|
||||
"name": "Checkmk/checkmk",
|
||||
"version": "v2.2.0p44",
|
||||
"date": "2025-07-04T06:44:06Z"
|
||||
},
|
||||
{
|
||||
"name": "redis/redis",
|
||||
"version": "8.2-rc1-int",
|
||||
"date": "2025-07-02T19:27:08Z"
|
||||
},
|
||||
{
|
||||
"name": "Jackett/Jackett",
|
||||
"version": "v0.22.2117",
|
||||
"date": "2025-07-04T05:56:05Z"
|
||||
},
|
||||
{
|
||||
"name": "hyperion-project/hyperion.ng",
|
||||
"version": "2.1.1",
|
||||
"date": "2025-06-14T17:45:06Z"
|
||||
},
|
||||
{
|
||||
"name": "steveiliop56/tinyauth",
|
||||
"version": "v3.4.1",
|
||||
"date": "2025-06-11T07:53:44Z"
|
||||
},
|
||||
{
|
||||
"name": "outline/outline",
|
||||
"version": "v0.85.0",
|
||||
@ -59,11 +184,6 @@
|
||||
"version": "15.2",
|
||||
"date": "2025-04-14T15:37:12Z"
|
||||
},
|
||||
{
|
||||
"name": "keycloak/keycloak",
|
||||
"version": "26.3.0",
|
||||
"date": "2025-07-02T12:26:44Z"
|
||||
},
|
||||
{
|
||||
"name": "cloudflare/cloudflared",
|
||||
"version": "2025.7.0",
|
||||
@ -94,11 +214,6 @@
|
||||
"version": "18.0.7",
|
||||
"date": "2025-07-03T08:57:21Z"
|
||||
},
|
||||
{
|
||||
"name": "fuma-nama/fumadocs",
|
||||
"version": "fumadocs-openapi@9.0.17",
|
||||
"date": "2025-07-03T06:57:48Z"
|
||||
},
|
||||
{
|
||||
"name": "esphome/esphome",
|
||||
"version": "2025.6.3",
|
||||
@ -119,11 +234,6 @@
|
||||
"version": "v1.12.2-rc.0",
|
||||
"date": "2025-07-03T00:31:22Z"
|
||||
},
|
||||
{
|
||||
"name": "cross-seed/cross-seed",
|
||||
"version": "v6.12.7",
|
||||
"date": "2025-06-18T03:44:24Z"
|
||||
},
|
||||
{
|
||||
"name": "emqx/emqx",
|
||||
"version": "v5.8.7",
|
||||
@ -144,16 +254,6 @@
|
||||
"version": "v0.9.5",
|
||||
"date": "2025-07-02T18:39:28Z"
|
||||
},
|
||||
{
|
||||
"name": "firefly-iii/firefly-iii",
|
||||
"version": "v6.2.20",
|
||||
"date": "2025-07-02T04:03:37Z"
|
||||
},
|
||||
{
|
||||
"name": "home-assistant/core",
|
||||
"version": "2025.7.0",
|
||||
"date": "2025-07-02T16:23:42Z"
|
||||
},
|
||||
{
|
||||
"name": "wazuh/wazuh",
|
||||
"version": "coverity-w27-4.13.0",
|
||||
@ -219,11 +319,6 @@
|
||||
"version": "v1.133.0",
|
||||
"date": "2025-07-01T15:13:42Z"
|
||||
},
|
||||
{
|
||||
"name": "syncthing/syncthing",
|
||||
"version": "v1.30.0",
|
||||
"date": "2025-07-01T11:29:11Z"
|
||||
},
|
||||
{
|
||||
"name": "rcourtman/Pulse",
|
||||
"version": "v99.99.99",
|
||||
@ -289,21 +384,6 @@
|
||||
"version": "0.50.5",
|
||||
"date": "2025-06-29T08:54:47Z"
|
||||
},
|
||||
{
|
||||
"name": "linkwarden/linkwarden",
|
||||
"version": "v2.11.2",
|
||||
"date": "2025-06-28T17:33:38Z"
|
||||
},
|
||||
{
|
||||
"name": "msgbyte/tianji",
|
||||
"version": "v1.22.5",
|
||||
"date": "2025-06-28T16:06:19Z"
|
||||
},
|
||||
{
|
||||
"name": "Luligu/matterbridge",
|
||||
"version": "3.1.0",
|
||||
"date": "2025-06-28T09:02:38Z"
|
||||
},
|
||||
{
|
||||
"name": "plexguide/Huntarr.io",
|
||||
"version": "8.1.11",
|
||||
@ -314,16 +394,6 @@
|
||||
"version": "v3.2.4",
|
||||
"date": "2025-06-28T02:47:31Z"
|
||||
},
|
||||
{
|
||||
"name": "pocket-id/pocket-id",
|
||||
"version": "v1.5.0",
|
||||
"date": "2025-06-27T22:04:32Z"
|
||||
},
|
||||
{
|
||||
"name": "homarr-labs/homarr",
|
||||
"version": "v1.26.0",
|
||||
"date": "2025-06-27T19:15:24Z"
|
||||
},
|
||||
{
|
||||
"name": "goauthentik/authentik",
|
||||
"version": "version/2025.6.3",
|
||||
@ -344,11 +414,6 @@
|
||||
"version": "flowise@3.0.3",
|
||||
"date": "2025-06-27T09:53:57Z"
|
||||
},
|
||||
{
|
||||
"name": "fallenbagel/jellyseerr",
|
||||
"version": "preview-seerr",
|
||||
"date": "2025-06-27T06:10:03Z"
|
||||
},
|
||||
{
|
||||
"name": "MediaBrowser/Emby.Releases",
|
||||
"version": "4.9.1.2",
|
||||
@ -424,64 +489,9 @@
|
||||
"version": "v25.2.0",
|
||||
"date": "2025-06-24T17:06:31Z"
|
||||
},
|
||||
{
|
||||
"name": "arunavo4/gitea-mirror",
|
||||
"version": "v2.18.0",
|
||||
"date": "2025-06-24T08:29:55Z"
|
||||
},
|
||||
{
|
||||
"name": "minio/minio",
|
||||
"version": "RELEASE.2025-06-13T11-33-47Z",
|
||||
"date": "2025-06-23T20:58:42Z"
|
||||
},
|
||||
{
|
||||
"name": "runtipi/runtipi",
|
||||
"version": "nightly",
|
||||
"date": "2025-06-23T19:10:33Z"
|
||||
},
|
||||
{
|
||||
"name": "VictoriaMetrics/VictoriaMetrics",
|
||||
"version": "pmm-6401-v1.120.0",
|
||||
"date": "2025-06-23T15:12:12Z"
|
||||
},
|
||||
{
|
||||
"name": "gotson/komga",
|
||||
"version": "1.22.0",
|
||||
"date": "2025-06-23T03:11:37Z"
|
||||
},
|
||||
{
|
||||
"name": "OliveTin/OliveTin",
|
||||
"version": "2025.6.22",
|
||||
"date": "2025-06-22T22:41:11Z"
|
||||
},
|
||||
{
|
||||
"name": "clusterzx/paperless-ai",
|
||||
"version": "v3.0.7",
|
||||
"date": "2025-06-22T17:49:29Z"
|
||||
},
|
||||
{
|
||||
"name": "TandoorRecipes/recipes",
|
||||
"version": "1.5.35",
|
||||
"date": "2025-06-22T08:30:10Z"
|
||||
},
|
||||
{
|
||||
"name": "inventree/InvenTree",
|
||||
"version": "0.17.14",
|
||||
"date": "2025-06-21T23:43:04Z"
|
||||
},
|
||||
{
|
||||
"name": "rogerfar/rdt-client",
|
||||
"version": "v2.0.114",
|
||||
"date": "2025-06-21T11:20:21Z"
|
||||
},
|
||||
{
|
||||
"name": "pocketbase/pocketbase",
|
||||
"version": "v0.28.4",
|
||||
"date": "2025-06-21T08:29:04Z"
|
||||
},
|
||||
{
|
||||
"name": "go-gitea/gitea",
|
||||
"version": "v1.24.2",
|
||||
"date": "2025-06-20T20:37:55Z"
|
||||
}
|
||||
]
|
||||
|
@ -1100,6 +1100,10 @@ start() {
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/tools.func)
|
||||
if command -v pveversion >/dev/null 2>&1; then
|
||||
install_script
|
||||
elif [ ! -z ${PHS_SILENT+x} ] && [[ "${PHS_SILENT}" == "1" ]]; then
|
||||
VERBOSE="no"
|
||||
set_std_mode
|
||||
update_script
|
||||
else
|
||||
CHOICE=$(whiptail --backtitle "[dev] Proxmox VE Helper Scripts" --title "${APP} LXC Update/Setting" --menu \
|
||||
"Support/Update functions for ${APP} LXC. Choose an option:" \
|
||||
|
@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2025 community-scripts ORG
|
||||
# Author: BvdBerg01
|
||||
# Author: BvdBerg01 | Co-Author: remz1337
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func)
|
||||
|
||||
function header_info {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
@ -16,8 +18,6 @@ function header_info {
|
||||
EOF
|
||||
}
|
||||
|
||||
source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/core.func)
|
||||
|
||||
header_info
|
||||
echo "Loading..."
|
||||
whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC Container Update" --yesno "This will update LXC container. Proceed?" 10 58 || exit
|
||||
@ -45,8 +45,8 @@ while read -r container; do
|
||||
done <<< "$containers"
|
||||
|
||||
CHOICE=$(whiptail --title "LXC Container Update" \
|
||||
--radiolist "Select LXC container to update:" 25 60 13 \
|
||||
"${menu_items[@]}" 3>&2 2>&1 1>&3)
|
||||
--checklist "Select LXC containers to update:" 25 60 13 \
|
||||
"${menu_items[@]}" 3>&2 2>&1 1>&3 | tr -d '"')
|
||||
|
||||
if [ -z "$CHOICE" ]; then
|
||||
whiptail --title "LXC Container Update" \
|
||||
@ -55,12 +55,21 @@ if [ -z "$CHOICE" ]; then
|
||||
fi
|
||||
|
||||
header_info
|
||||
if(whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC Container Update" --yesno "Do you want to create a backup from your container?" 10 58); then
|
||||
BACKUP_CHOICE="no"
|
||||
if(whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC Container Update" --yesno "Do you want to backup your containers before update?" 10 58); then
|
||||
BACKUP_CHOICE="yes"
|
||||
fi
|
||||
|
||||
UNATTENDED_UPDATE="no"
|
||||
if(whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC Container Update" --yesno "Run updates unattended?" 10 58); then
|
||||
UNATTENDED_UPDATE="yes"
|
||||
fi
|
||||
|
||||
if [ "$BACKUP_CHOICE" == "yes" ]; then
|
||||
STORAGES=$(awk '/^(\S+):/ {storage=$2} /content.*backup/ {print storage}' /etc/pve/storage.cfg)
|
||||
|
||||
if [ -z "$STORAGES" ]; then
|
||||
whiptail --msgbox "Geen opslag met 'backup' gevonden!" 8 40
|
||||
whiptail --msgbox "No storage with 'backup' found!" 8 40
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -75,37 +84,148 @@ if(whiptail --backtitle "Proxmox VE Helper Scripts" --title "LXC Container Updat
|
||||
msg_error "No storage selected!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
msg_info "Creating backup"
|
||||
vzdump $CHOICE --compress zstd --storage $STORAGE_CHOICE -notes-template "community-scripts backup updater" > /dev/null 2>&1
|
||||
function backup_container(){
|
||||
msg_info "Creating backup for container $1"
|
||||
vzdump $1 --compress zstd --storage $STORAGE_CHOICE -notes-template "community-scripts backup updater" > /dev/null 2>&1
|
||||
status=$?
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
msg_ok "Backup created"
|
||||
pct exec $CHOICE -- update --from-pve
|
||||
exit_code=$?
|
||||
else
|
||||
msg_error "Backup failed"
|
||||
msg_error "Backup failed for container $1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
else
|
||||
pct exec $CHOICE -- update --from-pve
|
||||
exit_code=$?
|
||||
UPDATE_CMD="update;"
|
||||
if [ "$UNATTENDED_UPDATE" == "yes" ];then
|
||||
UPDATE_CMD="export PHS_SILENT=1;update;"
|
||||
fi
|
||||
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
msg_ok "Update completed"
|
||||
else
|
||||
containers_needing_reboot=()
|
||||
for container in $CHOICE; do
|
||||
msg_info "Updating container $container"
|
||||
|
||||
if [ "BACKUP_CHOICE" == "yes" ];then
|
||||
backup_container $container
|
||||
fi
|
||||
|
||||
#1) Detect service using the service name in the update command
|
||||
pushd $(mktemp -d) >/dev/null
|
||||
pct pull "$container" /usr/bin/update update 2>/dev/null
|
||||
service=$(cat update | sed 's|.*/ct/||g' | sed 's|\.sh).*||g')
|
||||
popd >/dev/null
|
||||
|
||||
#1.1) If update script not detected, return
|
||||
if [ -z "${service}" ]; then
|
||||
echo -e "${YW}[WARN]${CL} Update script not found. Skipping to next container"
|
||||
continue
|
||||
else
|
||||
echo -e "${BL}[INFO]${CL} Detected service: ${GN}${service}${CL}"
|
||||
fi
|
||||
|
||||
#2) Extract service build/update resource requirements from config/installation file
|
||||
script=$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/${service}.sh)
|
||||
config=$(pct config "$container")
|
||||
build_cpu=$(echo "$script" | { grep -m 1 "var_cpu" || test $? = 1; } | sed 's|.*=||g' | sed 's|"||g' | sed 's|.*var_cpu:-||g' | sed 's|}||g')
|
||||
build_ram=$(echo "$script" | { grep -m 1 "var_ram" || test $? = 1; } | sed 's|.*=||g' | sed 's|"||g' | sed 's|.*var_ram:-||g' | sed 's|}||g')
|
||||
run_cpu=$(echo "$script" | { grep -m 1 "pct set \$CTID -cores" || test $? = 1; } | sed 's|.*cores ||g')
|
||||
run_ram=$(echo "$script" | { grep -m 1 "pct set \$CTID -memory" || test $? = 1; } | sed 's|.*memory ||g')
|
||||
current_cpu=$(echo "$config" | grep -m 1 "cores:" | sed 's|cores: ||g')
|
||||
current_ram=$(echo "$config" | grep -m 1 "memory:" | sed 's|memory: ||g')
|
||||
|
||||
#Test if all values are valid (>0)
|
||||
if [ -z "${run_cpu}" ] || [ "$run_cpu" -le 0 ]; then
|
||||
#echo "No valid value found for run_cpu. Assuming same as current configuration."
|
||||
run_cpu=$current_cpu
|
||||
fi
|
||||
|
||||
if [ -z "${run_ram}" ] || [ "$run_ram" -le 0 ]; then
|
||||
#echo "No valid value found for run_ram. Assuming same as current configuration."
|
||||
run_ram=$current_ram
|
||||
fi
|
||||
|
||||
if [ -z "${build_cpu}" ] || [ "$build_cpu" -le 0 ]; then
|
||||
#echo "No valid value found for build_cpu. Assuming same as current configuration."
|
||||
build_cpu=$current_cpu
|
||||
fi
|
||||
|
||||
if [ -z "${build_ram}" ] || [ "$build_ram" -le 0 ]; then
|
||||
#echo "No valid value found for build_ram. Assuming same as current configuration."
|
||||
build_ram=$current_ram
|
||||
fi
|
||||
|
||||
UPDATE_BUILD_RESOURCES=0
|
||||
if [ "$build_cpu" -gt "$run_cpu" ] || [ "$build_ram" -gt "$run_ram" ]; then
|
||||
UPDATE_BUILD_RESOURCES=1
|
||||
fi
|
||||
|
||||
#3) if build resources are different than run resources, then:
|
||||
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
||||
pct set "$container" --cores "$build_cpu" --memory "$build_ram"
|
||||
fi
|
||||
|
||||
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
|
||||
|
||||
#4) Update service, using the update command
|
||||
case "$os" in
|
||||
alpine) pct exec "$container" -- ash -c "$UPDATE_CMD" ;;
|
||||
archlinux) pct exec "$container" -- bash -c "$UPDATE_CMD" ;;
|
||||
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "$UPDATE_CMD" ;;
|
||||
ubuntu | debian | devuan) pct exec "$container" -- bash -c "$UPDATE_CMD" ;;
|
||||
opensuse) pct exec "$container" -- bash -c "$UPDATE_CMD" ;;
|
||||
esac
|
||||
exit_code=$?
|
||||
|
||||
#5) if build resources are different than run resources, then:
|
||||
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
||||
pct set "$container" --cores "$run_cpu" --memory "$run_ram"
|
||||
fi
|
||||
|
||||
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
|
||||
# Get the container's hostname and add it to the list
|
||||
container_hostname=$(pct exec "$container" hostname)
|
||||
containers_needing_reboot+=("$container ($container_hostname)")
|
||||
fi
|
||||
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
msg_ok "Updated container $container"
|
||||
elif [ "BACKUP_CHOICE" == "yes" ];then
|
||||
msg_info "Restoring LXC from backup"
|
||||
pct stop $CHOICE
|
||||
LXC_STORAGE=$(pct config $CHOICE | awk -F '[:,]' '/rootfs/ {print $2}')
|
||||
pct restore $CHOICE /var/lib/vz/dump/vzdump-lxc-$CHOICE-*.tar.zst --storage $LXC_STORAGE --force > /dev/null 2>&1
|
||||
pct start $CHOICE
|
||||
pct stop $container
|
||||
LXC_STORAGE=$(pct config $container | awk -F '[:,]' '/rootfs/ {print $2}')
|
||||
pct restore $container /var/lib/vz/dump/vzdump-lxc-${container}-*.tar.zst --storage $LXC_STORAGE --force > /dev/null 2>&1
|
||||
pct start $container
|
||||
restorestatus=$?
|
||||
if [ $restorestatus -eq 0 ]; then
|
||||
msg_ok "Restored LXC from backup"
|
||||
else
|
||||
msg_error "Restored LXC from backup failed"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
msg_error "Update failed for container $container. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
wait
|
||||
header_info
|
||||
echo -e "${GN}The process is complete, and the containers have been successfully updated.${CL}\n"
|
||||
if [ "${#containers_needing_reboot[@]}" -gt 0 ]; then
|
||||
echo -e "${RD}The following containers require a reboot:${CL}"
|
||||
for container_name in "${containers_needing_reboot[@]}"; do
|
||||
echo "$container_name"
|
||||
done
|
||||
echo -ne "${INFO} Do you wish to reboot these containers? <yes/No> "
|
||||
read -r prompt
|
||||
if [[ ${prompt,,} =~ ^(yes)$ ]]; then
|
||||
echo -e "${CROSS}${HOLD} ${YWB}Rebooting containers.${CL}"
|
||||
for container_name in "${containers_needing_reboot[@]}"; do
|
||||
container=$(echo $container_name | cut -d " " -f 1)
|
||||
pct reboot ${container}
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user