From 195893f440d67daf2d8e49af84b1a8aea98db4f2 Mon Sep 17 00:00:00 2001 From: HikariKnight <2557889+HikariKnight@users.noreply.github.com> Date: Thu, 11 Jan 2024 05:05:15 +0100 Subject: [PATCH] feat(just): add toggle-nvk, addresses #182 --- build/ublue-os-just/40-nvidia.just | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build/ublue-os-just/40-nvidia.just b/build/ublue-os-just/40-nvidia.just index 400d74e2..ab1353a0 100644 --- a/build/ublue-os-just/40-nvidia.just +++ b/build/ublue-os-just/40-nvidia.just @@ -58,3 +58,17 @@ configure-nvidia ACTION="prompt": echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' fi fi + +# Switch between Nvidia image and NVK +toggle-nvk: + #!/usr/bin/bash + CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"' | sed -E 's/^.+\/(.+:.+)$/\1/') + CURRENT_URI=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"' | sed -E 's/^(.+\/).+:.+$/\1/') + NEW_IMAGE=$CURRENT_IMAGE + if [[ "$CURRENT_IMAGE" =~ "nvidia" ]]; then + NEW_IMAGE=${CURRENT_IMAGE/-nvidia/} + else + NEW_IMAGE=${CURRENT_IMAGE/:/-nvidia:} + fi + echo "Rebasing to ${NEW_IMAGE}" + rpm-ostree rebase ${CURRENT_URI}${NEW_IMAGE}