├── .gitignore ├── LICENSE ├── README.md ├── Vagrantfile ├── patch.sh └── scripts ├── 90pvepatch ├── apply.sh ├── patch-test.sh ├── proxmox-patch-tests-control.txt ├── proxmox-patch-tests-original.txt └── proxmox-patch-tests.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2019 kosmonavtika 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pve-patch 2 | 3 | Removes subscription dialogs, replaces enterprise repository with non-subscription repository and replaces branding. Tested on PVE 6.0-7. 4 | 5 | *Note: I'm not using Proxmox VE anymore. Please submit a PR if you'd like to have it updated for later versions.* 🤗 6 | 7 | ## Note 8 | 9 | Use at your own risk! Read the script before you run it. 10 | 11 | ## Install 12 | 13 | 1. Connect to node via SSH 14 | 2. Run 15 | 16 | ```bash 17 | # if root 18 | wget -qO - https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh | bash 19 | 20 | # if non-root 21 | wget -qO - https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh | sudo bash 22 | ``` 23 | 24 | ## Restore 25 | 26 | Enterprise repository 27 | 28 | ``` 29 | mv /etc/apt/sources.list.d/pve-enterprise.list~ /etc/apt/sources.list.d/pve-enterprise.list 30 | ``` 31 | 32 | Branding 33 | 34 | ``` 35 | cp -f /usr/share/pve-manager/images/favicon.ico~ \ 36 | /usr/share/pve-patch/images/favicon.ico && \ 37 | cp -f /usr/share/pve-manager/images/logo-128.png~ \ 38 | /usr/share/pve-patch/images/logo-128.png && \ 39 | cp -f /usr/share/pve-manager/images/proxmox_logo.png~ \ 40 | /usr/share/pve-patch/images/proxmox_logo.png && \ 41 | /usr/share/pve-patch/scripts/apply.sh 42 | ``` 43 | 44 | ## Test 45 | 46 | ``` 47 | vagrant up 48 | ``` 49 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.define "pve-patch" 6 | config.vm.box = "proxmox-ve-amd64" 7 | config.vm.network "private_network", ip: "10.91.0.10" 8 | config.vm.provision "shell", path: "https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/patch.sh" 9 | end 10 | -------------------------------------------------------------------------------- /patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir -p /usr/share/pve-patch/scripts 4 | echo "- patch `pveversion`..." 5 | echo "- download and copy files..." 6 | rm -f /usr/share/pve-patch/scripts/{90pvepatch,apply.sh} 7 | wget -qP /usr/share/pve-patch/scripts/ https://raw.githubusercontent.com/kosmonavtika/pve-patch/master/scripts/{90pvepatch,apply.sh} 8 | chmod -R a+x /usr/share/pve-patch/scripts 9 | cp -f /usr/share/pve-patch/scripts/90pvepatch /etc/apt/apt.conf.d/90pvepatch 10 | /usr/share/pve-patch/scripts/apply.sh 11 | echo "- done!" 12 | -------------------------------------------------------------------------------- /scripts/90pvepatch: -------------------------------------------------------------------------------- 1 | DPkg::Post-Invoke { "/usr/share/pve-patch/scripts/apply.sh"; }; 2 | -------------------------------------------------------------------------------- /scripts/apply.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DEBIAN_CODENAME=$(cat /etc/os-release | grep VERSION_CODENAME | cut -d "=" -f2) 4 | ENTERPRISE_REPO_LIST="/etc/apt/sources.list.d/pve-enterprise.list" 5 | FREE_REPO_FILE="/etc/apt/sources.list.d/pve.list" 6 | FREE_REPO_LIST=$(cat <<-EOF 7 | # PVE pve-no-subscription repository provided by proxmox.com, 8 | # NOT recommended for production use 9 | deb http://download.proxmox.com/debian/pve ${DEBIAN_CODENAME} pve-no-subscription 10 | EOF 11 | ) 12 | JSLIBFILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js" 13 | 14 | function pve_patch() { 15 | echo "- apply patch..." 16 | echo "$FREE_REPO_LIST" > $FREE_REPO_FILE 17 | [ -f $ENTERPRISE_REPO_LIST ] && mv $ENTERPRISE_REPO_LIST $ENTERPRISE_REPO_LIST~ 18 | # (6.1 and up) 19 | sed -i.backup "s/data.status !== 'Active'/false/g" ${JSLIBFILE} 20 | # (6.2-11 and up) 21 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.false/false/g" ${JSLIBFILE} 22 | # (6.2-12 and up) 23 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status \!== 'Active'/false/g" ${JSLIBFILE} 24 | # (6.2-15 6.3-2 6.3-3 6.3-4 6.3-6 and up) 25 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" ${JSLIBFILE} 26 | systemctl restart pveproxy.service 27 | 28 | } 29 | 30 | pve_patch 31 | -------------------------------------------------------------------------------- /scripts/patch-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | CONTROLFILE='proxmox-patch-tests-control.txt' 3 | ORIGINALFILE='proxmox-patch-tests-original.txt' 4 | TESTFILE='proxmox-patch-tests.txt' 5 | sed -i.backup "s/data.status !== 'Active'/false/g" ${TESTFILE} 6 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.false/false/g"${TESTFILE} 7 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status \!== 'Active'/false/g" ${TESTFILE} 8 | sed -i.backup -z "s/res === null || res === undefined || \!res || res\n\t\t\t.data.status.toLowerCase() \!== 'active'/false/g" ${TESTFILE} 9 | 10 | echo "Comparing ${TESTFILE} file after replacements with ${ORIGINALFILE}" 11 | echo '====================================================' 12 | diff -y ${TESTFILE} ${ORIGINALFILE} 13 | echo '====================================================' 14 | 15 | echo "Comparing ${TESTFILE} file after replacements with ${CONTROLFILE}" 16 | echo '====================================================' 17 | diff -y ${TESTFILE} ${CONTROLFILE} 18 | echo '====================================================' 19 | echo "Run the below to reset the ${TESTFILE} file after replacements with ${ORIGINALFILE}" 20 | echo '====================================================' 21 | echo "rm -f ${TESTFILE} && cp ${ORIGINALFILE} ${TESTFILE}" 22 | echo '====================================================' 23 | 24 | -------------------------------------------------------------------------------- /scripts/proxmox-patch-tests-control.txt: -------------------------------------------------------------------------------- 1 | # (6.1 and up) 2 | if (false) { 3 | 4 | # (6.2-11 and up) 5 | if (false) { 6 | 7 | # (6.2-12 and up) 8 | if (false) { 9 | 10 | # (6.2-15 6.3-2 6.3-3 6.3-4 6.3-6 and up) 11 | if (false) { 12 | -------------------------------------------------------------------------------- /scripts/proxmox-patch-tests-original.txt: -------------------------------------------------------------------------------- 1 | # (6.1 and up) 2 | if (data.status !== 'Active') { 3 | 4 | # (6.2-11 and up) 5 | if (res === null || res === undefined || !res || res 6 | .false) { 7 | 8 | # (6.2-12 and up) 9 | if (res === null || res === undefined || !res || res 10 | .data.status !== 'Active') { 11 | 12 | # (6.2-15 6.3-2 6.3-3 6.3-4 6.3-6 and up) 13 | if (res === null || res === undefined || !res || res 14 | .data.status.toLowerCase() !== 'active') { 15 | 16 | -------------------------------------------------------------------------------- /scripts/proxmox-patch-tests.txt: -------------------------------------------------------------------------------- 1 | # (6.1 and up) 2 | if (data.status !== 'Active') { 3 | 4 | # (6.2-11 and up) 5 | if (res === null || res === undefined || !res || res 6 | .false) { 7 | 8 | # (6.2-12 and up) 9 | if (res === null || res === undefined || !res || res 10 | .data.status !== 'Active') { 11 | 12 | # (6.2-15 6.3-2 6.3-3 6.3-4 6.3-6 and up) 13 | if (res === null || res === undefined || !res || res 14 | .data.status.toLowerCase() !== 'active') { 15 | --------------------------------------------------------------------------------