Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PBS and PMG #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 55 additions & 41 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin

# installer main body:
_main() {
# detect environment
PVE=$(systemctl show pveproxy.service --no-page | grep 'LoadState=' | cut -f2 -d=)
PMG=$(systemctl show pmgproxy.service --no-page | grep 'LoadState=' | cut -f2 -d=)
PBS=$(systemctl show proxmox-backup-proxy.service --no-page | grep 'LoadState=' | cut -f2 -d=)
if [ "$PVE" = "loaded" ]; then
SERVICE="pve"
SERVICE_MANAGER="pve-manager"
elif [ "$PMG" = "loaded" ]; then
SERVICE="pmg"
SERVICE_MANAGER="pmg-manager"
elif [ "$PBS" = "loaded" ]; then
SERVICE="pbs"
SERVICE_MANAGER="proxmox-backup-manager"
else
echo "No Proxmox service detected; exiting."
exit 1
fi


# ensure $1 exists so 'set -u' doesn't error out
{ [ "$#" -eq "0" ] && set -- ""; } > /dev/null 2>&1

Expand All @@ -52,17 +71,18 @@ _main() {
_usage
;;
esac

exit 0
}

_uninstall() {
set -x
[ -f "/etc/apt/apt.conf.d/86pve-nags" ] &&
rm -f "/etc/apt/apt.conf.d/86pve-nags"
[ -f "/usr/share/pve-nag-buster.sh" ] &&
rm -f "/usr/share/pve-nag-buster.sh"
[ -f "/etc/apt/apt.conf.d/86${SERVICE}-nags" ] &&
rm -f "/etc/apt/apt.conf.d/86${SERVICE}-nags"
[ -f "/usr/share/${SERVICE}-nag-buster.sh" ] &&
rm -f "/usr/share/${SERVICE}-nag-buster.sh"

echo "Script and dpkg hooks removed, please manually remove /etc/apt/sources.list.d/pve-no-subscription.list if desired"
echo "Script and dpkg hooks removed, please manually remove /etc/apt/sources.list.d/${SERVICE}-no-subscription.list if desired"
}

_install() {
Expand All @@ -77,26 +97,26 @@ _install() {
RELEASE=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release)
fi

# create the pve-no-subscription list
echo "Creating PVE no-subscription repo list ..."
cat <<- EOF > "/etc/apt/sources.list.d/pve-no-subscription.list"
# .list file automatically generated by pve-nag-buster at $(date)
# create the ${SERVICE}-no-subscription list
echo "Creating ${SERVICE} no-subscription repo list ..."
cat <<- EOF > "/etc/apt/sources.list.d/${SERVICE}-no-subscription.list"
# .list file automatically generated by ${SERVICE}-nag-buster at $(date)
#
# If pve-nag-buster is installed again this file will be overwritten
# If ${SERVICE}-nag-buster is installed again this file will be overwritten
#

deb http://download.proxmox.com/debian/pve $RELEASE pve-no-subscription
deb http://download.proxmox.com/debian/${SERVICE} $RELEASE ${SERVICE}-no-subscription
EOF

# create dpkg pre/post install hooks for persistence
echo "Creating dpkg hooks in /etc/apt/apt.conf.d ..."
cat <<- 'EOF' > "/etc/apt/apt.conf.d/86pve-nags"
cat <<- EOF > "/etc/apt/apt.conf.d/86${SERVICE}-nags"
DPkg::Pre-Install-Pkgs {
"while read -r pkg; do case $pkg in *proxmox-widget-toolkit* | *pve-manager*) touch /tmp/.pve-nag-buster && exit 0; esac done < /dev/stdin";
"while read -r pkg; do case \$pkg in *proxmox-widget-toolkit* | *${SERVICE_MANAGER}*) touch /tmp/.${SERVICE}-nag-buster && exit 0; esac done < /dev/stdin";
};

DPkg::Post-Invoke {
"[ -f /tmp/.pve-nag-buster ] && { /usr/share/pve-nag-buster.sh; rm -f /tmp/.pve-nag-buster; }; exit 0";
"[ -f /tmp/.${SERVICE}-nag-buster ] && { /usr/share/${SERVICE}-nag-buster.sh; rm -f /tmp/.${SERVICE}-nag-buster; }; exit 0";
};
EOF

Expand All @@ -106,23 +126,23 @@ _install() {
# packed script requested
temp="$(mktemp)" && trap "rm -f $temp" EXIT
emit_script > "$temp"
elif [ -f "pve-nag-buster.sh" ]; then
elif [ -f "${SERVICE}-nag-buster.sh" ]; then
# local copy available
temp="pve-nag-buster.sh"
temp="${SERVICE}-nag-buster.sh"
else
# fetch from github
echo "Fetching hook script from GitHub ..."
tempd="$(mktemp -d)" &&
trap "echo 'Cleaning up temporary files ...'; rm -f $tempd/*; rmdir $tempd" EXIT
temp="$tempd/pve-nag-buster.sh"
wget https://raw.githubusercontent.com/foundObjects/pve-nag-buster/master/pve-nag-buster.sh \
temp="$tempd/${SERVICE}-nag-buster.sh"
wget https://raw.githubusercontent.com/foundObjects/pve-nag-buster/master/${SERVICE}-nag-buster.sh \
-q --show-progress -O "$temp"
fi
echo "Installing hook script as /usr/share/pve-nag-buster.sh"
install -o root -m 0550 "$temp" "/usr/share/pve-nag-buster.sh"
echo "Installing hook script as /usr/share/${SERVICE}-nag-buster.sh"
install -o root -m 0550 "$temp" "/usr/share/${SERVICE}-nag-buster.sh"

echo "Running patch script"
/usr/share/pve-nag-buster.sh
/usr/share/${SERVICE}-nag-buster.sh

return 0
}
Expand All @@ -139,26 +159,20 @@ _install() {
# pve-nag-buster.sh (v04) encoded below:

emit_script() {
base64 -d << 'YEET' | unxz
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4AYGA5ZdABGIQkY99BY0cwoNj8U0dcgowbs41qLC+aej
mGQYj9kDeUYQYXlWIuqhoJLO08e8hIe8MoGJqvcVxM5VQehFNPqq4OH1KhbHgYGz5QSdcYFBPv2D
jY49io85pCEdBXRw6wLkkTOpm7NoQQs6ZJ5F+vtHWz70HmnRfNhHpjrb16GcK0ERg/VLAx58EUIU
t9OVgypxnKVdJL7/XxL/nUYLT65sn6ZQvKn4HpuPvK5eKgjZfBYJ3Q0CPDeFlXWIew43sqJTwmlX
drWBSOlU6yMbmhWTJvfLpK9UfBAh6Qwp6UJ6i0H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udG9Mb3dlckNhc2UoKSAhPT0gJ2FjdGl2ZSciCk5BR0ZJTEU9Ii91c3Ivc2hhcmUvamF2YXNjcmlwdC9wcm94bW94LXdpZGdldC10b29sa2l0L3Byb3htb3hsaWIuanMiClNDUklQVD0iJChiYXNlbmFtZSAiJDAiKSIKUEFJRF9CQVNFPSIvZXRjL2FwdC9zb3VyY2VzLmxpc3QuZC9wYnMtZW50ZXJwcmlzZSIKCiMgZGlzYWJsZSBwYWlkIHJlcG8gbGlzdAoKaWYgWyAtZiAiJFBBSURfQkFTRS5saXN0IiBdOyB0aGVuCiAgZWNobyAiJFNDUklQVDogRGlzYWJsaW5nIFBWRSBwYWlkIHJlcG8gbGlzdCAuLi4iCiAgbXYgLWYgIiRQQUlEX0JBU0UubGlzdCIgIiRQQUlEX0JBU0UuZGlzYWJsZWQiCmZpCgojIGRpc2FibGUgbGljZW5zZSBuYWc6IGh0dHBzOi8vam9obnNjcy5jb20vcmVtb3ZlLXByb3htb3g1MS1zdWJzY3JpcHRpb24tbm90aWNlLwoKaWYgZ3JlcCAtcXMgIiROQUdUT0tFTiIgIiROQUdGSUxFIiA+IC9kZXYvbnVsbCAyPiYxOyB0aGVuCiAgZWNobyAiJFNDUklQVDogUmVtb3ZpbmcgTmFnIC4uLiIKICBzZWQgLWkub3JpZyAicy8kTkFHVE9LRU4vZmFsc2UvZyIgIiROQUdGSUxFIgogIHN5c3RlbWN0bCByZXN0YXJ0IHByb3htb3gtYmFja3VwLXByb3h5LnNlcnZpY2UKZmk="
case "$SERVICE" in
"pve")
echo ${pve_script} | base64 -d
;;
"pmg")
echo ${pmg_script} | base64 -d
;;
"pbs")
echo ${pbs_script} | base64 -d
;;
esac
}

assert_root() { [ "$(id -u)" -eq '0' ] || { echo "This action requires root." && exit 1; }; }
Expand Down
40 changes: 40 additions & 0 deletions pbs-nag-buster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
#
# pbs-nag-buster.sh (v05) https://github.com/foundObjects/pve-nag-buster
# Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue)
#
# Removes Proxmox Backup Server license nags automatically after updates
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

NAGTOKEN="data.status.toLowerCase() !== 'active'"
NAGFILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
SCRIPT="$(basename "$0")"
PAID_BASE="/etc/apt/sources.list.d/pbs-enterprise"

# disable paid repo list

if [ -f "$PAID_BASE.list" ]; then
echo "$SCRIPT: Disabling PVE paid repo list ..."
mv -f "$PAID_BASE.list" "$PAID_BASE.disabled"
fi

# disable license nag: https://johnscs.com/remove-proxmox51-subscription-notice/

if grep -qs "$NAGTOKEN" "$NAGFILE" > /dev/null 2>&1; then
echo "$SCRIPT: Removing Nag ..."
sed -i.orig "s/$NAGTOKEN/false/g" "$NAGFILE"
systemctl restart proxmox-backup-proxy.service
fi
40 changes: 40 additions & 0 deletions pmg-nag-buster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
#
# pmg-nag-buster.sh (v05) https://github.com/foundObjects/pve-nag-buster
# Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue)
#
# Removes Proxmox Mail Gateway license nags automatically after updates
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

NAGTOKEN="data.status.toLowerCase() !== 'active'"
NAGFILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
SCRIPT="$(basename "$0")"
PAID_BASE="/etc/apt/sources.list.d/pmg-enterprise"

# disable paid repo list

if [ -f "$PAID_BASE.list" ]; then
echo "$SCRIPT: Disabling PMG paid repo list ..."
mv -f "$PAID_BASE.list" "$PAID_BASE.disabled"
fi

# disable license nag: https://johnscs.com/remove-proxmox51-subscription-notice/

if grep -qs "$NAGTOKEN" "$NAGFILE" > /dev/null 2>&1; then
echo "$SCRIPT: Removing Nag ..."
sed -i.orig "s/$NAGTOKEN/false/g" "$NAGFILE"
systemctl restart pmgproxy.service
fi
22 changes: 11 additions & 11 deletions pve-nag-buster.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# pve-nag-buster.sh (v04) https://github.com/foundObjects/pve-nag-buster
# pve-nag-buster.sh (v05) https://github.com/foundObjects/pve-nag-buster
# Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue)
#
# Removes Proxmox VE 6.x+ license nags automatically after updates
Expand All @@ -22,20 +22,20 @@
NAGTOKEN="data.status.toLowerCase() !== 'active'"
NAGFILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
SCRIPT="$(basename "$0")"

# disable license nag: https://johnscs.com/remove-proxmox51-subscription-notice/

if grep -qs "$NAGTOKEN" "$NAGFILE" > /dev/null 2>&1; then
echo "$SCRIPT: Removing Nag ..."
sed -i.orig "s/$NAGTOKEN/false/g" "$NAGFILE"
systemctl restart pveproxy.service
fi
PAID_BASE="/etc/apt/sources.list.d/pve-enterprise"

# disable paid repo list

PAID_BASE="/etc/apt/sources.list.d/pve-enterprise"

if [ -f "$PAID_BASE.list" ]; then
echo "$SCRIPT: Disabling PVE paid repo list ..."
mv -f "$PAID_BASE.list" "$PAID_BASE.disabled"
fi


# disable license nag: https://johnscs.com/remove-proxmox51-subscription-notice/

if grep -qs "$NAGTOKEN" "$NAGFILE" > /dev/null 2>&1; then
echo "$SCRIPT: Removing Nag ..."
sed -i.orig "s/$NAGTOKEN/false/g" "$NAGFILE"
systemctl restart pveproxy.service
fi