Last active
December 22, 2024 00:21
-
-
Save tavinus/08a63e7269e0f70d27b8fb86db596f0d to your computer and use it in GitHub Desktop.
Remove PROXMOX 5.x / 6.x / 7.3-4 subscription message popup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
####################################################### | |
# | |
# Edits the proxmox Subscription file to make it | |
# think that it has a Subscription. | |
# | |
# Will disable the annoying login message about | |
# missing subscription. | |
# | |
# Tested on Proxmox PVE v5.2-1 / v6.0-4 / v6.3-2 / 7.2-11 / 7.3-4 | |
# | |
# The sed command will create a backup of the changed file. | |
# There is no guarantee that this will work for future versions. | |
# Use at your own risk! | |
# | |
# OneLiner: | |
# wget -q -O - 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' | /bin/sh | |
# curl -L -s 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' | /bin/sh | |
# | |
# Save to Local File: | |
# wget -q -O rem_proxmox_popup.sh 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' && chmod +x rem_proxmox_popup.sh | |
# curl -L -o rem_proxmox_popup.sh 'https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d/raw/' && chmod +x rem_proxmox_popup.sh | |
# | |
# Then you can just run the file after updates: | |
# ./rem_proxmox_popup.sh | |
# | |
####################################################### | |
init_error() { | |
local ret=1 | |
[ -z "$1" ] || printf "%s\n" "$1" | |
[ -z "$2" ] || ret=$2 | |
exit $ret | |
} | |
# Original command | |
# sed -i.bak 's/NotFound/Active/g' /usr/share/perl5/PVE/API2/Subscription.pm && systemctl restart pveproxy.service | |
# Command to restart PVE Proxy and apply changes | |
PVEPXYRESTART='systemctl restart pveproxy.service' | |
# File/folder to be changed | |
TGTPATH='/usr/share/perl5/PVE/API2' | |
TGTFILE='Subscription.pm' | |
# Check dependecies | |
SEDBIN="$(which sed)" | |
[ -x "$SEDBIN" ] || init_error "Could not find 'sed' binary, aborting..." | |
# This will also create a .bak file with the original file contents | |
sed -i.bak 's/NotFound/Active/g' "$TGTPATH/$TGTFILE" | |
sed -i.bak 's/notfound/active/g' "$TGTPATH/$TGTFILE" | |
$PVEPXYRESTART | |
# Removed execution checking, since the terminal gets closed after PVEPXYRESTART anyways | |
exit 0 |
... .Feel free to fork and make your own version if you want.
thanks for your suggestion.
following what you suggested, I've rewritten it in my version at these gist.
regards,
nGadmini binti nGadimin
Works with Proxmox 7.4-3 as of this morning.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure what is "polluting" what here. Seems fine to me. Feel free to fork and make your own version if you want.
Also, I am not sure how removing the bak file instead of overwriting it solves anything. Testing if the bak file exists is useless for this use case. It changes nothing. Delete + write VS overwrite is basically the same thing.
We would need to check if we have 'NotFoud' or 'notfound' inside the file. Then it could be of some use (we would know if we have the old or the new proxmox and run the sed command only once).
Grouping the 2 sed commands can actually be useful for the current code, but if we decide to check for the 2 possibilities, it would not be needed. I will think about it (and test it).
Also, still does not solve the main problem of overwriting an old bak file, which could be an actual problem.
The easiest solution is probably to timestamp the backup file name. This way we get a new name every time and we know when that happened.
Cheers!