Update postinstall

This commit is contained in:
Thorsten Spille
2026-01-19 21:01:54 +01:00
committed by GitHub
parent 651aa628a8
commit 6fa3220784

View File

@@ -8,7 +8,6 @@
# + Install and configure zfs-auto-snapshot # + Install and configure zfs-auto-snapshot
# + Switch pve-enterprise/pve-no-subscription/pvetest repo # + Switch pve-enterprise/pve-no-subscription/pvetest repo
# + Switch ceph repo between quincy/reef and enterprise/no-subscription/test or remove # + Switch ceph repo between quincy/reef and enterprise/no-subscription/test or remove
# + Disable "No subscription message" in webinterface in no-subscription mode
# + Add pve-enterprise subscription key # + Add pve-enterprise subscription key
# + Update system to the latest version # + Update system to the latest version
# + Install common tools # + Install common tools
@@ -198,7 +197,6 @@ auto_snapshot(){
} }
select_subscription(){ select_subscription(){
suppress_warning=0
if [[ $sub_status == "notfound" ]] || [[ $sub_status == "invalid" ]]; then if [[ $sub_status == "notfound" ]] || [[ $sub_status == "invalid" ]]; then
if [[ $repo_selection == "pve-enterprise" ]]; then if [[ $repo_selection == "pve-enterprise" ]]; then
if whiptail --title "NO PROXMOX SUBSCRIPTION FOUND" \ if whiptail --title "NO PROXMOX SUBSCRIPTION FOUND" \
@@ -208,14 +206,6 @@ select_subscription(){
--yesno "Server ID: $serverid\n\nDo you want to add a subscription key?" 9 76 ; then --yesno "Server ID: $serverid\n\nDo you want to add a subscription key?" 9 76 ; then
input_subscription input_subscription
fi fi
else
if whiptail --title "NO PROXMOX SUBSCRIPTION FOUND" \
--backtitle $PROG \
--yes-button "SUPPRESS WARNING" \
--no-button "REMOVE HACK" \
--yesno "Do you want to suppress the no subscription warning in WebUI?" 9 76 ; then
suppress_warning=1
fi
fi fi
fi fi
} }
@@ -259,54 +249,6 @@ set_subscription(){
fi fi
} }
suppress_no_subscription_warning(){
# remove old no-sub-hack
if [ -f /opt/bashclub/no-sub-hack.sh ] ; then rm -r /opt/bashclub ; fi
if [ -f /etc/apt/apt.conf.d/80bashclubapthook ] ; then rm /etc/apt/apt.conf.d/80bashclubapthook ; fi
if [ $suppress_warning -gt 0 ]; then
cat << EOF > /usr/local/bin/suppress_no_subscription_warning
#!/bin/bash
# Proxmox no-subscription hack
filename=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
# Prüfe, ob checked_command bereits im gewünschten Zustand ist
if grep -q 'checked_command: function(orig_cmd) { orig_cmd(); },' "\$filename"; then
echo "checked_command bereits gepatcht, keine Änderung notwendig."
exit 0
fi
# Finde die erste Zeile mit checked_command
first_line=\$(grep -n -m1 'checked_command' "\$filename" | cut -d':' -f1)
# Hole die Einrückung der Startzeile
indent=\$(sed -n "\${first_line}p" "\$filename" | grep -o '^[[:space:]]*')
# Suche ab first_line die erste Zeile, die mit identischer Einrückung und '},' endet
last_line=\$(( \$(tail -n "+\${first_line}" "\$filename" | grep -nxm1 "^\${indent}},\$" | cut -d':' -f1) + first_line - 1 ))
# Entferne den Block
sed -i "\${first_line},\${last_line}d" "\$filename"
# Füge die neue checked_command-Funktion an der richtigen Stelle ein
insert_line=\$(( first_line - 1 ))
ex "\$filename" <<eof
\${insert_line} insert
\${indent}checked_command: function(orig_cmd) { orig_cmd(); },
.
xit
eof
systemctl restart pveproxy.service
EOF
chmod +x /usr/local/bin/suppress_no_subscription_warning
cat << EOF > /etc/apt/apt.conf.d/80-suppress_no_subscription_warning
DPkg::Post-Invoke {"/usr/local/bin/suppress_no_subscription_warning";};
EOF
else
if [ -f /usr/local/bin/suppress_no_subscription_warning ] ; then rm /usr/local/bin/suppress_no_subscription_warning ; fi
if [ -f /etc/apt/apt.conf.d/80-suppress_no_subscription_warning ] ; then rm /etc/apt/apt.conf.d/80-suppress_no_subscription_warning ; fi
fi
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install --reinstall -y -qq proxmox-widget-toolkit > /dev/null 2>&1
}
select_pve_repo(){ select_pve_repo(){
pveenterprise=OFF pveenterprise=OFF
pvenosubscription=OFF pvenosubscription=OFF
@@ -822,7 +764,6 @@ installation_task(){
set_swappiness set_swappiness
set_auto_snapshot set_auto_snapshot
pve_conf_backup pve_conf_backup
suppress_no_subscription_warning
harden_ssh harden_ssh
set_notification set_notification
create_swap_pool create_swap_pool
@@ -868,7 +809,6 @@ summary(){
locales: $locales\n\ locales: $locales\n\
repository: $repo_selection \n\ repository: $repo_selection \n\
subscription: $(pvesubscription get | grep status | cut -d' ' -f2)\n\ subscription: $(pvesubscription get | grep status | cut -d' ' -f2)\n\
suppress subscription warning: $suppress_warning\n\
install auto-snapshot: $install_zas ($autosnap)\n\ install auto-snapshot: $install_zas ($autosnap)\n\
ssh-hardening: $ssh_hardening\n\ ssh-hardening: $ssh_hardening\n\
mail delivery: $mailconfig mail delivery: $mailconfig