diff --git a/files/scripts/prefer-bootc-over-rpm-ostree.sh b/files/scripts/prefer-bootc-over-rpm-ostree.sh new file mode 100644 index 00000000..2e01aa2d --- /dev/null +++ b/files/scripts/prefer-bootc-over-rpm-ostree.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cat << EOF > /etc/profile.d/prefer-bootc-over-rpm-ostree.sh +# Prefer 'bootc update/upgrade' & 'bootc switch' over rpm-ostree's equivalent functionality +rpm-ostree() { + if [[ ${#} -eq 0 ]]; then + /usr/bin/rpm-ostree + elif [[ -n "$(awk '/(^|\s)('update'|'upgrade')($|\s)/' <<< "${@}")" ]]; then + echo "ERROR: Don't use 'rpm-ostree update/upgrade', use 'sudo bootc update/upgrade' instead." + echo " Some functionality like kargs.d is only available when using bootc, hence why Gidro-OS slowly deprecates using rpm-ostree." + elif [[ -n "$(awk '/(^|\s)('rebase')($|\s)/' <<< "${@}")" ]]; then + echo "ERROR: Don't use 'rpm-ostree rebase', use 'sudo bootc switch' instead." + echo " Some functionality like kargs.d is only available when using bootc, hence why Gidro-OS slowly deprecates using rpm-ostree." + else + /usr/bin/rpm-ostree "${@}" + fi +} + +export -f rpm-ostree +EOF \ No newline at end of file diff --git a/recipes/module-recipes/scripts.yml b/recipes/module-recipes/scripts.yml index e30c11be..2872dc5d 100644 --- a/recipes/module-recipes/scripts.yml +++ b/recipes/module-recipes/scripts.yml @@ -3,6 +3,7 @@ scripts: - morewaita.sh - sleep-through-notifications.sh - disable-layering.sh + - prefer-bootc-over-rpm-ostree.sh - hardened-chromium-disable-network-sandbox.sh snippets: