Last active
March 1, 2023 19:19
-
-
Save ts-sz/f2fb901fd945cbf051713803649833e8 to your computer and use it in GitHub Desktop.
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 PMG 5.2-3 | |
# | |
# 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/ts-sz/f2fb901fd945cbf051713803649833e8/raw/' | /bin/sh | |
# curl -L -s 'https://gist.github.com/ts-sz/f2fb901fd945cbf051713803649833e8/raw/' | /bin/sh | |
# | |
# idea from: https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d | |
####################################################### | |
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/PMG/API2/Subscription.pm && systemctl restart pmgproxy.service | |
# Command to restart PMG Proxy and apply changes | |
PMGPXYRESTART='systemctl restart pmgproxy.service' | |
# File/folder to be changed | |
TGTPATH='/usr/share/perl5/PMG/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" && $PMGPXYRESTART | |
r=$? | |
if [ $r -eq 0 ]; then | |
printf "%s\n" "All done! Please refresh your browser and test the changes!" | |
exit 0 | |
fi | |
printf "%s\n" "An error was detected! Changes may not have been applied!" | |
exit 1 |
Working on Proxmox 5.4-3. Thanks!!!
Hi bro @ts-sz
sed installed by default, so no need to check it's availability. your gist should be more simple as below:
#!/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 PMG 5.2-3
#
# 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/ts-sz/f2fb901fd945cbf051713803649833e8/raw/' | /bin/sh
# curl -L -s 'https://gist.github.com/ts-sz/f2fb901fd945cbf051713803649833e8/raw/' | /bin/sh
#
# idea from: https://gist.github.com/tavinus/08a63e7269e0f70d27b8fb86db596f0d
#######################################################
# Original command
# sed -i.bak 's/NotFound/Active/g' /usr/share/perl5/PMG/API2/Subscription.pm && systemctl restart pmgproxy.service
# Command to restart PMG Proxy and apply changes
PMGPXYRESTART='systemctl restart pmgproxy.service'
# File/folder to be changed
TGTPATH='/usr/share/perl5/PMG/API2/Subscription.pm'
# This will also create a .bak file with the original file contents
sed -i.bak 's/NotFound/Active/g' "$$TGTPATH"
r=$?
if [ $r -eq 0 ]; then
$PMGPXYRESTART
printf "%s\n" "All done! Please refresh your browser and test the changes!"
exit 0
else
printf "%s\n" "An error was detected! Changes may not have been applied!"
exit 1
fi
regards
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Working on Mail Gateway 7.0-8