Commit 0ab864e9 authored by free-pmx's avatar free-pmx
Browse files

v0.3.0

parent 381f293d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
Package: free-pmx-no-subscription
Version: 0.3.0~pre2
Version: 0.3.0
Section: utils
Priority: optional
Architecture: all
Maintainer: free-pmx <179050296+free-pmx@users.noreply.github.com>
Description: No-subscription setup tool for Proxmox product suite
 Disables default (enterprise) and sets up no-subscription repositories,
 fetches Proxmox release key when necessary. Proxmox repositories ONLY.
 Eliminates 'No valid subscription' notice and related visual artefacts
 through series of modular idempotent patches. Failure mode - no operation.
 Disables default (enterprise), sets up no-subscription repositories
 and fetches Proxmox release key. All Proxmox repositories ONLY.
 Eliminates 'No valid subscription' notice and related marketing artefacts
 through series of modular JavaScript patches with graceful failure mode.
 Full auto-setup during install. Configuration file for feature control.
 Supported products: PVE, PBS, PMG
Homepage: https://free-pmx.pages.dev
+59 −59
Original line number Diff line number Diff line
d61c3994e99a53c00c48037d0881663f  bin/no-subscription
7f5a7ed8d67899c4a38348627984d2d2  bin/no-nag
11b63066afbc741db19c7a5b39298695  bin/no-subscription
a80c4258d3579310b1f879a0dc5d49c1  bin/no-nag
0bf823d188da1cac01ba85f600c7c6c8  etc/free-pmx/no-subscription.conf
3a524aa44f80bf6f83e1eb0d9b16f13f  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.6.3-4.orig
3716146f7fd13f15c279c5584a473c62  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.patchdef
59c52b29b1423dc64bef240027fdc07e  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.2.2-3.repl
9356c4d830e321edff1b86c84871f167  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.7.4-4.orig
6d774369c6cbe02e8d49361769768a3c  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.0.3.0.orig
85d5f2630c9678b4fa04b65f61120f46  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.8.4.2.repl
4d4291c566c88a56aca6956d4a91f97e  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.4.3.12.repl
09b0a0cbfe566d240d15094e55088d11  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.3.3-2.orig
5c20bc244a0b74e89bcf8d2894e51533  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.patchdef
e4f86f483e5d668fdc3b0c08454d13fa  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.0.5.orig
b79a7d3f1a93a7f769a048d7ff448c9e  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.3.3-2.repl
9a060663942d525c1af6b7f437a79614  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.0.5.repl
8f297442f60b69fa5470a3526641f90e  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.8.4.2.orig
183ffddf49740e915409f78497408bfc  usr/lib/free-pmx/no-subscription-common
9bd6a5ceb0426f7fe9a5f9ce6e5c060d  usr/lib/free-pmx/no-subscription-util
3dc8e4195bb78d0d358a80a409e56294  usr/lib/free-pmx/aptsrc-replace
d00fc852f6f0b873dba118bc18f22d6b  usr/lib/free-pmx/aptkey-check
bef30e6a758399be862802542040d20d  usr/lib/free-pmx/patchdef-apply
848db278859016b379abb6e14601af83  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.4.3.12.orig
88b218ec7216fae712bce104e8c3f6ab  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.4.3.12.orig
fdc3e500138592ea73a96b8d71c6895c  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.4.3.12.repl
319b8807e6dace6eefea3549cd6234e1  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.0.5.repl
8f297442f60b69fa5470a3526641f90e  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.8.4.2.orig
80dba665fad49085ffd8ed7c1029ac03  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.patchdef
4c6db0942211ce360bc48dc006ce3812  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.6.3-4.repl
4684d428b8a9c72c52c19ccf3f6140a6  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.patchdef
0601d8fa9eae2305c6a7f077449de008  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.2.2-3.orig
5f6b764637c963c492ef5e540b055e61  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.7.4-4.repl
0a898bfdc1681dc94736a8b416dd6283  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.patchdef
6726890bc5b8dd5731ba291e3ee70c1e  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.0.3.0.repl
66fed538c5f187e946bc5eba4f657401  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.patchdef
4c6db0942211ce360bc48dc006ce3812  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.6.3-4.repl
505e7d661fc690484c1f0c5ea1b5dd8e  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.patchdef
7c5fcdad1b41717d14fd411eba5b76e9  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.3.2-1.repl
de3240cb9c03e87b1b2556f69d3a7b2c  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.patchdef
3ead2fec321f9e968994922d3d4a55c6  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.4.3.12.repl
28cf54dba9a806bf3504a449a589780c  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.3.4.3.repl
078857e96f2ac97947b82cc27ec70a67  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.4.3.12.repl
47f7ef1aa84d645debbd76f6aab76ec7  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.6.3-4.repl
ed3d2e5a82947e4abafc1fb0f812d4e2  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.3.2-1.orig
f9e9c86d696e5675cb7efa49d2568fa5  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.patchdef
f5454205118526e470834f10752e8f28  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.patchdef
848db278859016b379abb6e14601af83  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.8.4.2.orig
502eb3096dd266c288a4b0c824bd18bc  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.4.2.0.repl
9356c4d830e321edff1b86c84871f167  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.7.4-4.orig
59c52b29b1423dc64bef240027fdc07e  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.2.2-3.repl
63b47d9decf9140f57a26ad1f6d0120a  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.patchdef
6d774369c6cbe02e8d49361769768a3c  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.0.3.0.orig
3a524aa44f80bf6f83e1eb0d9b16f13f  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.6.3-4.orig
64475af403ebaff2e13cdc1daac2dd8e  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.patchdef
5c2e7cc13c44a2fe0987a354cc292038  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.4.3.12.orig
5f6b764637c963c492ef5e540b055e61  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.2.3-7.repl
dc995c49ede456a3e49382a6104c7dad  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.3.12.orig
02361f07758b902b9fe10517fa6b3b74  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.8.4.2.orig
3364df137d9194d18364f14a53af5b37  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.patchdef
e4f86f483e5d668fdc3b0c08454d13fa  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.0.5.orig
3ead2fec321f9e968994922d3d4a55c6  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.4.3.12.repl
4d4291c566c88a56aca6956d4a91f97e  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.4.3.12.repl
7a03527076d1755c924d2d4aeb9ff4c6  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.8.4.2.repl
3ead2fec321f9e968994922d3d4a55c6  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.8.4.2.repl
09b0a0cbfe566d240d15094e55088d11  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.3.3-2.orig
f021fb66cc0ba6a35ac43555bd32508e  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.8.4.2.repl
2ea68454c14e9953757b9b1086690563  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.3.12.repl
fdc3e500138592ea73a96b8d71c6895c  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.4.3.12.repl
ee6735763acd10df4700932d194fa58e  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.4.2.0.orig
3ead2fec321f9e968994922d3d4a55c6  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.8.4.2.repl
9356c4d830e321edff1b86c84871f167  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.2.3-7.orig
7d9c15a902f4291ed01711db693ffb68  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.patchdef
2ea68454c14e9953757b9b1086690563  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.3.12.repl
3bb2f6b495a73b8d1473a2c313558089  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.patchdef
28b9664d398c21ca6ad7c1c4665f51dd  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.patchdef
0ff920d8bdc08ddbf56f617aae937430  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.6.3-4.orig
672b3eb2412fef19a43bc6696b70237e  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.3.2-1.repl
43a298458d1aaa18783d360069f1cb6a  usr/share/free-pmx/no-nag-patchdefs/pve-10-dc-sum-sub.patchdef
848db278859016b379abb6e14601af83  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.4.3.12.orig
017fd5422d6b2926f4dbd70728e80cbe  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.3.2-1.orig
d93633b7885158a5aeed33f7f9f16837  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.4.3.12.orig
552d6226063a4367dd735a04b25f9914  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.3.4.3.orig
b9ef8fd248a9635ff286f7912045a686  usr/share/free-pmx/no-subscription-aptsrcs/pmg-no-subscription.sources.template
50ba8c52ff0afcd27c5d2ea9aefbabe4  usr/share/free-pmx/no-subscription-aptsrcs/ceph-no-subscription.list.template
ff0382a75aa18e459d8ad54a26a57fab  usr/share/free-pmx/no-subscription-aptsrcs/pbs-no-subscription.list.template
b0083c63c8ac7380a044237ff4ba30ec  usr/share/free-pmx/no-subscription-aptsrcs/pbs-no-subscription.sources.template
65f7889ef84e831af75df55fa60d258b  usr/share/free-pmx/no-subscription-aptsrcs/ceph-no-subscription.sources.template
530253c98c1e1a61ff98a71a61c5b299  usr/share/free-pmx/no-subscription-aptsrcs/pmg-no-subscription.list.template
f3decc23ffab57bf54d858d96c0bf9f0  usr/share/free-pmx/no-subscription-aptsrcs/pve-no-subscription.sources.template
cf76a26033f94dbe24d0c004ca444158  usr/share/free-pmx/no-subscription-aptsrcs/pve-no-subscription.list.template
d93633b7885158a5aeed33f7f9f16837  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.4.3.12.orig
14f368be45067a8f3087d5cc525befe2  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.patchdef
5f6b764637c963c492ef5e540b055e61  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.2.3-7.repl
017fd5422d6b2926f4dbd70728e80cbe  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.3.2-1.orig
672b3eb2412fef19a43bc6696b70237e  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.3.2-1.repl
9356c4d830e321edff1b86c84871f167  usr/share/free-pmx/no-nag-patchdefs/pwt-10-msg.2.3-7.orig
ed3d2e5a82947e4abafc1fb0f812d4e2  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.3.2-1.orig
7c5fcdad1b41717d14fd411eba5b76e9  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.3.2-1.repl
1033f432dd37c5086486382d1ea94e5a  usr/share/free-pmx/no-nag-patchdefs/pwt-30-repos-stat-state.patchdef
47f7ef1aa84d645debbd76f6aab76ec7  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.6.3-4.repl
078857e96f2ac97947b82cc27ec70a67  usr/share/free-pmx/no-nag-patchdefs/pwt-32-repos-list-line.4.3.12.repl
65b80b89b7eac52ec0c7cc97ba37f14a  usr/share/free-pmx/no-nag-patchdefs/pbs-10-sum-sub.3.4.3.repl
15854cc581445053b6e0b48e7b730f7f  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.patchdef
848db278859016b379abb6e14601af83  usr/share/free-pmx/no-nag-patchdefs/pve-90-mobile-msg.8.4.2.orig
b79a7d3f1a93a7f769a048d7ff448c9e  usr/share/free-pmx/no-nag-patchdefs/pwt-20-repo-stat.3.3-2.repl
dc995c49ede456a3e49382a6104c7dad  usr/share/free-pmx/no-nag-patchdefs/pwt-31-repos-stat-line.4.3.12.orig
9c870ae17b13da723a65029d15d8b182  usr/share/free-pmx/no-nag-patchdefs/pmg-10-sum-sub.4.2.0.repl
02361f07758b902b9fe10517fa6b3b74  usr/share/free-pmx/no-nag-patchdefs/pve-11-dc-sum-node-sup.8.4.2.orig
b4a8fc26f5f516ac6ae209780790b8c2  usr/share/free-pmx/no-subscription-aptsrcs/pmg-no-subscription.sources.template
0231972aa0cc80e7b8ae7c9c28f9e4fe  usr/share/free-pmx/no-subscription-aptsrcs/pbs-no-subscription.list.template
8420cb8846b8ee968d25ac1f896799f7  usr/share/free-pmx/no-subscription-aptsrcs/ceph-no-subscription.list.template
1fb3cd55e8bdc30d9b866cad8582a5a4  usr/share/free-pmx/no-subscription-aptsrcs/pve-no-subscription.sources.template
1771a84c56c452fb2cc5b26500b9b001  usr/share/free-pmx/no-subscription-aptsrcs/pve-no-subscription.list.template
6dbfdf609879386e4ad41244a998993c  usr/share/free-pmx/no-subscription-aptsrcs/ceph-no-subscription.sources.template
c90c2957a5feff104ca10c9aee58a8b6  usr/share/free-pmx/no-subscription-aptsrcs/pbs-no-subscription.sources.template
6686f5f6d7417c16535a03d043537876  usr/share/free-pmx/no-subscription-aptsrcs/pmg-no-subscription.list.template
86ba8e04a458c15c1dd04b56a88e6385  usr/share/doc/free-pmx-no-subscription/copyright
89c3d0db191151724df7add3179a945d  usr/share/doc/free-pmx-no-subscription/changelog.gz
b3964f0e6464c200597bc079ba5839b2  usr/share/man/man1/no-subscription.1.gz
a64e7265c7af8fc00eb976cf774691ef  usr/share/man/man1/no-nag.1.gz
53c027577554bac85c17ad5d428adc05  usr/lib/free-pmx/repo-list-replace
b7fa781747231ef813ce4579c063d081  usr/lib/free-pmx/no-subscription-common
6c73f7dca427b13e289683d75035f6fa  usr/lib/free-pmx/no-subscription-util
081e05678d3d5c3757efa5932e75251d  usr/lib/free-pmx/patchdef-apply
3850fac1abe2f2bacc5a1b543dbc4ea9  usr/lib/free-pmx/repo-key-check
169fdaf151ff5b63170716da54c8b1d8  usr/share/doc/free-pmx-no-subscription/changelog.gz
d8c52ac4b64cf7ff9636dd2a441cf3be  usr/share/man/man1/no-nag.1.gz
c0ec354802cc793999e451bfdd63bd1e  usr/share/man/man1/no-subscription.1.gz
+26 −34
Original line number Diff line number Diff line
#!/bin/bash
set -e

source "/usr/lib/free-pmx/no-subscription-common" \
    && declare_ns_globals \
    && declare_nn_globals \
    || {
        echo "ERROR: ${0##*/} - auto-run skipped." >&2
        exit 0
    }

case "$1" in

configure)

    no-subscription -a || echo "ISSUES reported: $1" >&2
    no-nag -a || echo "ISSUES reported: $1" >&2

    ;;

triggered)

    for t in $2; do

            case "$t" in

                "/etc/apt/sources.list.d/pve-enterprise.sources"|\
                "/etc/apt/sources.list.d/pbs-enterprise.sources"|\
                "/etc/apt/sources.list.d/pmg-enterprise.sources"|\
                "/etc/apt/sources.list.d/pve-enterprise.list"|\
                "/etc/apt/sources.list.d/pbs-enterprise.list"|\
                "/etc/apt/sources.list.d/pmg-enterprise.list")

                    no-subscription -at "$t" || echo "ISSUES reported: $1 $2" >&2

                ;;

                "/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"|\
                "/usr/share/pve-manager/js/pvemanagerlib.js"|\
                "/usr/share/pve-manager/touch/pvemanager-mobile.js"|\
                "/usr/share/javascript/proxmox-backup/js/proxmox-backup-gui.js"|\
                "/usr/share/javascript/pmg-gui/js/pmgmanagerlib.js")

                    no-nag -at "$t" || echo "ISSUES reported: $1 $2" >&2

                ;;

            esac
        if [[ -v APTSRC_TARGET_TO_ID[$t] ]]; then
            no-subscription -at "$t" || echo "ISSUES reported: $1 $t" >&2
        elif [[ -v PATCHDEF_TARGET_TO_IDS[$t] ]]; then
            no-nag -at "$t" || echo "ISSUES reported: $1 $t" >&2
        fi

    done

    ;;

abort-upgrade | abort-remove | abort-deconfigure)

    :
    ;;

*)
        echo "ERROR: $0 - unknown argument: $1" >&2

    echo "ERROR: ${0##*/} - unknown argument: $1" >&2
    exit 1
    ;;

esac
+48 −40
Original line number Diff line number Diff line
#!/bin/bash

# SPDX-FileCopyrightText: Copyright 2025 free-pmx
# SPDX-License-Identifier: AGPL-3.0-only

echo
echo "free-pmx: NO-NAG - 'No Subscription' Nags Removal"
trap "echo" EXIT

declare -i status=0

source "/usr/lib/free-pmx/no-subscription-common" 2> /dev/null \
|| { echo "Internal error, aborting." >&2; exit 1; }
source "/usr/lib/free-pmx/no-subscription-common" \
    && init_out \
    || exit 255

init "FREE_PMX_NO_NAG" "$@"
print OUT
print OUT "free-pmx: NO-NAG - 'No Subscription' Nags Removal"
trap 'print OUT' EXIT

(( ${#ARGS[@]} == 0 )) \
|| { echo "Arguments not supported." >&2; exit 1; }
init_run "FREE_PMX_NO_NAG" "$@"

{ declare_patchdefs; declare -i err=$?; }
(( err & 1+2 )) && echo "Warning: Issues parsing some patch definitions."
declare_nn_globals || {
    print ERR "Warning: Issues parsing some patch definitions."
}

declare -a targets=()
((${#ARGS[@]} == 0)) || {
    print ERR "Arguments not supported."
    exit 1
}

declare -a targets=()
if [[ -n $O_TARGET ]]; then
    echo "Explicit target: $O_TARGET"
    print OUT "Explicit target specified."
    targets+=("$O_TARGET")
else
    targets+=("${AVAIL_PATCH_TARGETS[@]}")
    targets+=("${PATCHDEF_TARGET_LIST[@]}")
fi

declare -i no_file_count=0
declare -i no_effect_count=0

for t in "${targets[@]}"; do
    if [[ -f "$t" ]] || [[ -n "$O_TARGET" ]]; then
        echo "Patches applicable to: $t ..."
declare -i no_file_count=0 no_effect_count=0
declare -ra bak_ext_variants=(bak original)
declare target
for target in "${targets[@]}"; do
    if [[ -f "$target" ]] || [[ -n "$O_TARGET" ]]; then
        print OUT "Patches applicable to: $target ..."

        declare -a todo_ids=()
        for i in "${ORD_PATCHDEF_IDS[@]}"; do
            if [[ ${PATCHDEF_TARGETS["$i"]} == "$t" ]]; then todo_ids+=("$i"); fi
        done
        IFS=';' read -r -a todo_ids <<< "${PATCHDEF_TARGET_TO_IDS[$target]}"

        (( ${#todo_ids[@]} == 0 )) \
        && { echo "No patch definitions for this target." >&2; status=1; }
        ((${#todo_ids[@]} == 0)) && {
            print ERR "No patch definitions for this target."
            ((status |= 1))
        }

        declare -i i
        for i in "${!todo_ids[@]}"; do
            declare bak_ext=""
            (( i == 0 )) && (( O_AUTORUN == 0 )) && bak_ext="bak"
            (( i == 0 )) && (( O_AUTORUN == 1 )) && bak_ext="original"
            declare bak_ext=''
            ((i)) || bak_ext="${bak_ext_variants[$O_AUTORUN]}"

            { run_pd_apply "${PATCHDEF_DIR}/${todo_ids[$i]}.patchdef" "$bak_ext"; declare -i err=$?; }
            (( err & 2 )) && no_file_count+=1
            (( err & 8 )) && no_effect_count+=1
            run_patchdef_apply "${PATCHDEF_DIR}/${todo_ids[$i]}.patchdef" "$bak_ext"
            declare -i err=$?
            ! ((err & 2)) || ((no_file_count++))
            ! ((err & 8)) || ((no_effect_count++))
        done
    fi
done

(( O_AUTORUN == 0 )) && (( no_file_count > 0 )) && cat << EOF
! ((O_AUTORUN)) && ((no_file_count > 0)) \
    && print ERR $'\e' << EOF

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: Some ($no_file_count) file(s) to patch NOT FOUND.
NOTICE: Some ($no_file_count) patch attempt(s) with target file NOT FOUND.

It is EXPECTED when running the command MANUALLY with explicit target file ('-t')
that does not exist as not all products are likely installed (PVE, PBS, PMG).
EOF

(( O_AUTORUN == 0 )) && (( no_effect_count > 0 )) && cat << EOF
! ((O_AUTORUN)) && ((no_effect_count > 0)) \
    && print ERR $'\e' << EOF

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: Some ($no_effect_count) patch(es) had NO EFFECT.
@@ -76,11 +83,12 @@ If you are still experiencing undesired artefacts in the web interface,
consider REFRESHING (CTRL+F5) your BROWSER or confirm the issue with ANOTHER.
EOF

(( O_AUTORUN == 0 )) && cat << 'EOF'
! ((O_AUTORUN)) \
    && print ERR $'\e' << EOF

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Visit <https://free-pmx.pages.dev/tools/free-pmx-no-subscription/>
Visit $NS_WEB
for more details, to check the latest version or to report an issue.
EOF

exit $status
exit $((status))
+75 −53
Original line number Diff line number Diff line
#!/bin/bash

# SPDX-FileCopyrightText: Copyright 2025 free-pmx
# SPDX-License-Identifier: AGPL-3.0-only

echo
echo "free-pmx: NO-SUBSCRIPTION - 'No Subscription' Repositories Setup"
trap "echo" EXIT

declare -i status=0

source "/usr/lib/free-pmx/no-subscription-common" 2> /dev/null \
|| { echo "Internal error, aborting." >&2; exit 1; }
source "/usr/lib/free-pmx/no-subscription-common" \
    && init_out \
    || exit 255

init "FREE_PMX_NO_SUBSCRIPTION" "$@"
print OUT
print OUT "free-pmx: NO-SUBSCRIPTION - 'No Subscription' Repositories Setup"
trap 'print OUT' EXIT

{ declare_aptsrcs; declare -i err=$?; }
(( err & 1 )) && { echo "Cannot gather necessary system information, aborting." >&2; exit 1; }
init_run "FREE_PMX_NO_SUBSCRIPTION" "$@"

{ declare -A todo_id_flags; for i in "${ORD_APTSRC_IDS[@]}"; do todo_id_flags["$i"]=0; done; }

if [[ -n $O_TARGET ]]; then
    (( ${#ARGS[@]} == 0 )) \
    || { echo "Arguments not allowed when used with '-t' option." >&2; exit 1; }
declare_ns_globals || {
    print ERR "Cannot gather necessary system information, aborting."
    exit 1
}

    declare list_id_match=''
declare -A todo_id_flags
declare id
for id in "${APTSRC_ID_LIST[@]}"; do todo_id_flags[$id]=0; done

    for i in "${!APTSRC_TARGETS[@]}"; do
        [[ $O_TARGET == "${APTSRC_TARGETS["$i"]}" ]] \
        && { list_id_match="$i"; todo_id_flags["$i"]=1; break; }
    done

    if [[ -n $list_id_match ]]; then
        echo "Explicit target recognised as $list_id_match: $O_TARGET"
if [[ -n $O_TARGET ]]; then
    ((${#ARGS[@]} == 0)) || {
        print ERR "Arguments not allowed when used with '-t' option."
        exit 1
    }

    declare id="${APTSRC_TARGET_TO_ID[$O_TARGET]}"
    if [[ -n $id ]]; then
        print OUT "Explicit target recognised."
        todo_id_flags[$id]=1
    else
        { echo "No defined repositories for this target." >&2; exit 1; }
        print ERR "No defined repositories for this target."
        ((status |= 1))
    fi
elif ((${#ARGS[@]} > 0)); then
    declare arg
    for arg in "${ARGS[@]}"; do
        case "$arg" in
            pve|pbs|pmg|ceph) todo_id_flags["$arg"]=1;;
            *) { echo "Invalid argument: $arg" >&2; exit 1; };;
        esac
        [[ -v APTSRC_ID_TO_TARGET[$arg] ]] || {
            print ERR "Invalid argument: $arg"
            exit 1
        }

        todo_id_flags[$arg]=1
    done
else
    echo -n "Detecting default sources ..."
    for i in "${ORD_APTSRC_IDS[@]}"; do
        [[ -f ${APTSRC_TARGETS["$i"]} ]] && todo_id_flags["$i"]=1 && echo -n " $i"
    declare id
    for id in "${APTSRC_ID_LIST[@]}"; do
        [[ -f ${APTSRC_ID_TO_TARGET[$id]} ]] && todo_id_flags[$id]=1 && echo -n " $id"
    done
    echo
fi

{ todo_count=0; for i in "${ORD_APTSRC_IDS[@]}"; do (( todo_count+=todo_id_flags[$i] )); done; }
done_count=0
declare -i todo_count=0 done_count=0
declare id
for id in "${APTSRC_ID_LIST[@]}"; do ((todo_count += todo_id_flags[$id])); done

if ((todo_count > 0)); then
    (( todo_id_flags["ceph"] == 1 )) && [[ -z $FREE_PMX_CEPH ]] \
    && { todo_id_flags["ceph"]=0; echo "Ceph codename not configured, skipping ..." >&2; }

    for i in "${ORD_APTSRC_IDS[@]}"; do
        (( todo_id_flags["$i"] == 1 )) \
        && echo "Setting up for $i ..." \
        && run_rl_replace "${APTSRC_TARGETS["$i"]}" "${APTSRC_TEMPLS["$i"]}" \
    ((todo_id_flags[ceph])) && [[ -z $FREE_PMX_CEPH ]] && {
        print ERR "Ceph codename not configured, skipping ..."
        todo_id_flags[ceph]=0
    }

    declare id
    for id in "${APTSRC_ID_LIST[@]}"; do
        ((todo_id_flags[$id])) \
            && print OUT "Setting up for $id ..." \
            && run_aptsrc_replace "${APTSRC_ID_TO_TARGET[$id]}" "${APTSRC_ID_TO_TEMPL[$id]}" \
            && ((done_count++))
    done
    (( done_count != todo_count )) && status=1
    ((done_count == todo_count)) || ((status |= 1))

    echo "Completed total $done_count of $todo_count."
    echo
    print OUT "Completed total $done_count of $todo_count."

    print OUT

    echo "Checking for Proxmox release key: $FREE_PMX_APTKEY_LOCAL ..."
    run_rk_check "$FREE_PMX_APTKEY_LOCAL" "$FREE_PMX_APTKEY_ORIGIN" \
    || { echo "Failed Proxmox release key check." >&2; status=1; }
    print OUT "Checking for Proxmox release key ..."

    if [[ $FREE_PMX_APTKEY == "$FREE_PMX_APTKEY_LOCAL" ]]; then
        run_aptkey_check "$FREE_PMX_APTKEY_LOCAL" "$FREE_PMX_APTKEY_ORIGIN" || {
            print ERR "Failed Proxmox release key check."
            ((status |= 1))
        }
    else
        print OUT "Skipped - custom key specified: $FREE_PMX_APTKEY"
    fi
else
    echo "Nothing to be set up."
    print OUT "Nothing to be set up."
fi

(( O_AUTORUN == 0 )) && (( done_count > 0 )) && cat << 'EOF'
! ((O_AUTORUN)) && ((done_count > 0)) \
    && print ERR $'\e' << EOF

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: Do not forget to perform UPDATE and UPGRADE, e.g.:
@@ -82,11 +103,12 @@ NOTICE: Do not forget to perform UPDATE and UPGRADE, e.g.:
    apt full-upgrade
EOF

(( O_AUTORUN == 0 )) && cat << 'EOF'
! ((O_AUTORUN)) \
    && print ERR $'\e' << EOF

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Visit <https://free-pmx.pages.dev/tools/free-pmx-no-subscription/>
Visit $NS_WEB
for more details, to check the latest version or to report an issue.
EOF

exit $status
exit $((status))
Loading