1
0
mirror of https://github.com/community-scripts/ProxmoxVE.git synced 2025-05-12 23:41:46 +00:00

Use onliner for updates (#4414)

This commit is contained in:
Slaviša Arežina 2025-05-12 16:07:07 +02:00 committed by GitHub
parent 4a3ee4db67
commit 9140fd52ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 106 additions and 115 deletions

View File

@ -72,8 +72,7 @@ network_check() {
update_os() { update_os() {
msg_info "Updating Container OS" msg_info "Updating Container OS"
apk update $STD apk -U upgrade
apk upgrade
msg_ok "Updated Container OS" msg_ok "Updated Container OS"
} }

View File

@ -22,8 +22,7 @@ catch_errors
function update_script() { function update_script() {
header_info header_info
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating AdGuard Home" msg_info "Updating AdGuard Home"

View File

@ -36,7 +36,7 @@ function update_script() {
header_info header_info
case $CHOICE in case $CHOICE in
1) 1)
apk update && apk upgrade $STD apk -U upgrade
exit exit
;; ;;
esac esac

View File

@ -22,8 +22,7 @@ catch_errors
function update_script() { function update_script() {
header_info header_info
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
apk update $STD apk -U upgrade
apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating Gitea" msg_info "Updating Gitea"

View File

@ -39,7 +39,7 @@ function update_script() {
header_info header_info
case $CHOICE in case $CHOICE in
1) 1)
apk update && apk upgrade $STD apk -U upgrade
exit exit
;; ;;
2) 2)

View File

@ -21,8 +21,7 @@ catch_errors
function update_script() { function update_script() {
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating MariaDB" msg_info "Updating MariaDB"

View File

@ -21,8 +21,7 @@ catch_errors
function update_script() { function update_script() {
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating Node.js and npm" msg_info "Updating Node.js and npm"

View File

@ -21,8 +21,7 @@ catch_errors
function update_script() { function update_script() {
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating PostgreSQL" msg_info "Updating PostgreSQL"

View File

@ -21,8 +21,7 @@ catch_errors
function update_script() { function update_script() {
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating Prometheus" msg_info "Updating Prometheus"

View File

@ -26,8 +26,7 @@ function update_script() {
fi fi
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "Updating tinyauth" msg_info "Updating tinyauth"

View File

@ -37,14 +37,15 @@ function update_script() {
header_info header_info
case $CHOICE in case $CHOICE in
1) 1)
apk update && apk upgrade && rc-service vaultwarden restart -q $STD apk -U upgrade
rc-service vaultwarden restart -q
exit exit
;; ;;
2) 2)
if NEWTOKEN=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "Setup your ADMIN_TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3); then if NEWTOKEN=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "Setup your ADMIN_TOKEN (make it strong)" 10 58 3>&1 1>&2 2>&3); then
if [[ -z "$NEWTOKEN" ]]; then exit-script; fi if [[ -z "$NEWTOKEN" ]]; then exit-script; fi
if ! command -v argon2 >/dev/null 2>&1; then apk add argon2 &>/dev/null; fi if ! command -v argon2 >/dev/null 2>&1; then apk add argon2 &>/dev/null; fi
TOKEN=$(echo -n ${NEWTOKEN} | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1) TOKEN=$(echo -n "${NEWTOKEN}" | argon2 "$(openssl rand -base64 32)" -e -id -k 19456 -t 2 -p 1)
if [[ ! -f /var/lib/vaultwarden/config.json ]]; then if [[ ! -f /var/lib/vaultwarden/config.json ]]; then
sed -i "s|export ADMIN_TOKEN=.*|export ADMIN_TOKEN='${TOKEN}'|" /etc/conf.d/vaultwarden sed -i "s|export ADMIN_TOKEN=.*|export ADMIN_TOKEN='${TOKEN}'|" /etc/conf.d/vaultwarden
else else

View File

@ -21,8 +21,7 @@ catch_errors
function update_script() { function update_script() {
msg_info "Updating Alpine Packages" msg_info "Updating Alpine Packages"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Alpine Packages" msg_ok "Updated Alpine Packages"
msg_info "update wireguard-tools" msg_info "update wireguard-tools"

View File

@ -36,7 +36,7 @@ function update_script() {
header_info header_info
case $CHOICE in case $CHOICE in
1) 1)
apk update && apk upgrade $STD apk -U upgrade
exit exit
;; ;;
esac esac

View File

@ -28,7 +28,7 @@ function update_script() {
header_info header_info
if [ "$UPD" == "1" ]; then if [ "$UPD" == "1" ]; then
apk update && apk upgrade $STD apk -U upgrade
exit exit
fi fi
} }

View File

@ -30,7 +30,7 @@ function update_script() {
case "$UPD" in case "$UPD" in
"1") "1")
msg_info "Updating Alpine OS" msg_info "Updating Alpine OS"
apk update && apk upgrade $STD apk -U upgrade
msg_ok "System updated" msg_ok "System updated"
exit exit
;; ;;

View File

@ -44,7 +44,7 @@
}, },
"notes": [ "notes": [
{ {
"text": "To Update Alpine: `apk update && apk upgrade`", "text": "To Update Alpine: `apk -U upgrade`",
"type": "info" "type": "info"
} }
] ]

View File

@ -137,8 +137,7 @@ network_check() {
# This function updates the Container OS by running apt-get update and upgrade # This function updates the Container OS by running apt-get update and upgrade
update_os() { update_os() {
msg_info "Updating Container OS" msg_info "Updating Container OS"
$STD apk update $STD apk -U upgrade
$STD apk upgrade
msg_ok "Updated Container OS" msg_ok "Updated Container OS"
msg_info "Installing core dependencies" msg_info "Installing core dependencies"

View File

@ -13,7 +13,7 @@ function update_container() {
echo -e "\n [Info] Updating $container : $name \n" echo -e "\n [Info] Updating $container : $name \n"
os=$(pct config "$container" | awk '/^ostype/ {print $2}') os=$(pct config "$container" | awk '/^ostype/ {print $2}')
case "$os" in case "$os" in
alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;; alpine) pct exec "$container" -- ash -c "apk -U upgrade" ;;
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;; archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;; fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;; ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;;
@ -33,17 +33,17 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
echo -e "[Info] Skipping $container" echo -e "[Info] Skipping $container"
sleep 1 sleep 1
else else
status=$(pct status $container) status=$(pct status "$container")
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") template=$(pct config "$container" | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "[Info] Starting $container" echo -e "[Info] Starting $container"
pct start $container pct start "$container"
sleep 5 sleep 5
update_container $container update_container "$container"
echo -e "[Info] Shutting down $container" echo -e "[Info] Shutting down $container"
pct shutdown $container & pct shutdown "$container" &
elif [ "$status" == "status: running" ]; then elif [ "$status" == "status: running" ]; then
update_container $container update_container "$container"
fi fi
fi fi
done done

View File

@ -5,7 +5,7 @@
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info { function header_info() {
clear clear
cat <<"EOF" cat <<"EOF"
__ __ __ __ __ _ ________ __ __ __ __ __ _ ________
@ -64,7 +64,7 @@ function update_container() {
echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}[No disk info for ${os}]${CL}\n" echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}[No disk info for ${os}]${CL}\n"
fi fi
case "$os" in case "$os" in
alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;; alpine) pct exec "$container" -- ash -c "apk -U upgrade" ;;
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;; archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;; fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable && apt-get -yq dist-upgrade 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;; ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable && apt-get -yq dist-upgrade 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;;