diff --git a/make-release.sh b/make-release.sh new file mode 100755 index 0000000..a864dea --- /dev/null +++ b/make-release.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +_VERS="v02" +_BRANCH=$(git branch --show-current) || + { echo "can't poll branch, defaulting to master" && _BRANCH="master"; } + +# update versions before packing install.sh +sed -i \ + -e "s;(v[[:digit:]][[:digit:]]);($_VERS);" \ + -e "s;nag-buster/.*/;nag-buster/$_BRANCH/;" \ + pve-nag-buster.sh install.sh README.md +#sed -i -e "s/([v[[:digit:]][[:digit:]])/($_VERS)/" pve-nag-buster.sh install.sh +#sed -i -e "s;nag-buster/.*/;nag-buster/$_BRANCH/;" install.sh README.md + +# I have no idea what I'm doing 🐶 +#awk 'FNR==NR{s=(!s)?$0:s RS $0;next} /__BASE64__/{sub(/__BASE64__/, s)} 1' \ +# <(xz -z -9 -c pve-nag-buster.sh | base64) src/install > install.sh + +# TODO: there's probably a two liner to handle all of this in awk + +# pack install.sh +{ + head -n"$(grep -n "<< 'YEET'" install.sh | cut -d: -f1)" install.sh + xz -z -9 -c pve-nag-buster.sh | base64 + tail -n+"$(grep -n '^YEET$' install.sh | cut -d: -f1)" install.sh +} > foofile +cat foofile > install.sh +rm -f foofile + diff --git a/src/install b/src/install deleted file mode 100644 index c8af705..0000000 --- a/src/install +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# pve-nag-buster (__VERSION__) https://github.com/foundObjects/pve-nag-buster -# Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue) -# -# Removes Proxmox VE 5.x 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. - -RELEASE=$(awk -F"[)(]+" '/VERSION=/ {print $2}' /etc/os-release) - -# create the pve-no-subscription list - -echo "$0: Creating PVE no-subscription repo list ..." -cat <"/etc/apt/sources.list.d/pve-no-subscription.list" -# .list file automatically generated by pve-nag-buster:$0 at $(date) -# -# If $0 is run again this file will likely be overwritten -# - -deb http://download.proxmox.com/debian/pve $RELEASE pve-no-subscription -EOF - -# create dpkg pre/post install hooks for persistence - -cat <<'EOF' >/etc/apt/apt.conf.d/86pve-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"; -}; - -DPkg::Post-Invoke { - "[ -f /tmp/.pve-nag-buster ] && { /usr/share/pve-nag-buster.sh; rm -f /tmp/.pve-nag-buster; }; exit 0"; -}; -EOF - -# fetch the post-install patch script, patches license nag and switches to pve-no-subscription repository as needed - -if true ; then - wget https://raw.githubusercontent.com/foundObjects/pve-nag-buster/master/pve-nag-buster.sh \ - -O "/usr/share/pve-nag-buster.sh" && \ - chmod +x "/usr/share/pve-nag-buster.sh" && \ - /usr/share/pve-nag-buster.sh - - exit 0 -fi - -# this is the end, example offline code below - -# Example code for inclusion into host provisioning scripts offline: this is just pve-nag-buster.sh -# run through "xz -z -9 -c pve-nag-buster.sh | base64" to avoid needing to fetch the script from github -# To use this installer offline just nuke the entire if block above. - -# Important: if you're not me you should probably decode this and read it to make sure I'm not doing -# something malicious like mining dogecoin or stealing your valuable cat pictures - -# pve-nag-buster.sh (__VERSION__) inline: - -base64 -d <<"YEET"| unxz > "/usr/share/pve-nag-buster.sh" && \ - chmod +x "/usr/share/pve-nag-buster.sh" && \ - /usr/share/pve-nag-buster.sh diff --git a/src/make-scripts.sh b/src/make-scripts.sh deleted file mode 100755 index f3a88a9..0000000 --- a/src/make-scripts.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -_VERS="v02" - -_OUTFILE="pve-nag-buster.sh" - -sed "s/__VERSION__/$_VERS/g" src/script > $_OUTFILE - -_OUTFILE="install.sh" - -sed "s/__VERSION__/$_VERS/g" src/install > $_OUTFILE -xz -z -9 -c pve-nag-buster.sh | base64 >> $_OUTFILE -echo "YEET" >> $_OUTFILE diff --git a/src/script b/src/script deleted file mode 100644 index 81fefa8..0000000 --- a/src/script +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -# pve-nag-buster.sh (__VERSION__) https://github.com/foundObjects/pve-nag-buster -# Copyright (C) 2019 /u/seaQueue (reddit.com/u/seaQueue) -# -# Removes Proxmox VE 5.x 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 !== 'Active'" -NAGFILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js" - -# disable license nag: https://johnscs.com/remove-proxmox51-subscription-notice/ - -if grep -qs "$NAGTOKEN" "$NAGFILE" > /dev/null 2>&1; then - echo "$0: Removing Nag ..." - sed -i.orig "s/$NAGTOKEN/false/g" "$NAGFILE" - systemctl restart pveproxy.service -fi - -# disable paid repo list - -PAID_BASE="/etc/apt/sources.list.d/pve-enterprise" - -if [ -f "$PAID_BASE.list" ]; then - echo "$0: Disabling PVE paid repo list ..." - mv -f "$PAID_BASE.list" "$PAID_BASE.disabled" -fi