commit 4657d19d82133c6c0710813b22a71e43a5a9a408 Author: sbennell Date: Tue Nov 5 08:20:45 2019 +1100 First upload diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2647fa4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vagrant +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0273aa4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2019 kosmonavtika + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..78fb8e1 --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# pve-patch + +Removes subscription dialogs, replaces enterprise repository with non-subscription repository and replaces branding. Tested on PVE 6.0-7. + +## Note + +Use at your own risk! Read the script before you run it. + +## Install + +1. Connect to node via SSH +2. Run + +```bash +# if root +wget -qO - https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh | bash + +# if non-root +wget -qO - https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh | sudo bash +``` + +## Restore + +Enterprise repository + +``` +mv /etc/apt/sources.list.d/pve-enterprise.list~ /etc/apt/sources.list.d/pve-enterprise.list +``` + +Branding + +``` +cp -f /usr/share/pve-manager/images/favicon.ico~ \ +/usr/share/pve-patch/images/favicon.ico && \ +cp -f /usr/share/pve-manager/images/logo-128.png~ \ +/usr/share/pve-patch/images/logo-128.png && \ +cp -f /usr/share/pve-manager/images/proxmox_logo.png~ \ +/usr/share/pve-patch/images/proxmox_logo.png && \ +/usr/share/pve-patch/scripts/apply.sh +``` + +## Test + +``` +vagrant up +``` diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..dba9520 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,9 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.define "pve-patch" + config.vm.box = "proxmox-ve-amd64" + config.vm.network "private_network", ip: "10.91.0.10" + config.vm.provision "shell", path: "https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh" +end diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000..b06fd66 Binary files /dev/null and b/images/favicon.ico differ diff --git a/images/logo-128.png b/images/logo-128.png new file mode 100644 index 0000000..a2262ac Binary files /dev/null and b/images/logo-128.png differ diff --git a/images/proxmox_logo.png b/images/proxmox_logo.png new file mode 100644 index 0000000..373dee0 Binary files /dev/null and b/images/proxmox_logo.png differ diff --git a/patch.sh b/patch.sh new file mode 100644 index 0000000..3452bfb --- /dev/null +++ b/patch.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +mkdir -p /usr/share/pve-patch/{images,scripts} +echo "- patch `pveversion`..." +echo "- download and copy files..." +wget -nc -qP /usr/share/pve-patch/images/ https://github.com/kosmonavtika/pve-patch/raw/master/images/{favicon.ico,logo-128.png,proxmox_logo.png} +rm -f /usr/share/pve-patch/scripts/{90pvepatch,apply.sh} +wget -qP /usr/share/pve-patch/scripts/ https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/scripts/{90pvepatch,apply.sh} +chmod -R a+x /usr/share/pve-patch/scripts +cp -f /usr/share/pve-patch/scripts/90pvepatch /etc/apt/apt.conf.d/90pvepatch +/usr/share/pve-patch/scripts/apply.sh +echo "- done!" diff --git a/scripts/90pvepatch b/scripts/90pvepatch new file mode 100644 index 0000000..2049a2e --- /dev/null +++ b/scripts/90pvepatch @@ -0,0 +1 @@ +DPkg::Post-Invoke { "/usr/share/pve-patch/scripts/apply.sh"; }; diff --git a/scripts/apply.sh b/scripts/apply.sh new file mode 100644 index 0000000..7d842bd --- /dev/null +++ b/scripts/apply.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +DEBIAN_CODENAME=`cat /etc/os-release | grep VERSION_CODENAME | cut -d "=" -f2` +ENTERPRISE_REPO_LIST="/etc/apt/sources.list.d/pve-enterprise.list" +FREE_REPO_LIST="/etc/apt/sources.list.d/pve.list" +FREE_REPO_LINE="deb http://download.proxmox.com/debian/pve $DEBIAN_CODENAME pve-no-subscription" + +function pve_patch() { + echo "- apply patch..." + echo $FREE_REPO_LINE > $FREE_REPO_LIST + [ -f $ENTERPRISE_REPO_LIST ] && mv $ENTERPRISE_REPO_LIST $ENTERPRISE_REPO_LIST~ + sed -i.bak "s/data.status !== 'Active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js + cp --backup /usr/share/pve-patch/images/* /usr/share/pve-manager/images/ +} + +pve_patch