From c7fc54a5190be4c52e888b66f5b0ede228bb34b6 Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Sun, 26 Nov 2023 19:46:07 +0100 Subject: [PATCH 1/2] feat(just): combine devmode on/off with gum --- just/custom.just | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/just/custom.just b/just/custom.just index 1cca36e18e9..b1979bd30f0 100644 --- a/just/custom.just +++ b/just/custom.just @@ -38,21 +38,8 @@ cockpit: code-profile: xdg-open https://vscode.dev/profile/github/c761b7738e9a7b02286d6d94cb2d1ecd -# Rebase to a stock Bluefin image -devmode-off: - #!/usr/bin/env bash - CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"') - if grep -q "bluefin-dx" <<< $CURRENT_IMAGE - then - echo "Rebasing to a non developer image" - NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin-dx/bluefin/") - rpm-ostree rebase $NEW_IMAGE - else - echo "You are currently not on a developer image" - fi - -# Rebase to the Bluefin Developer Experience image -devmode-on: +# Toggle between Bluefin and the Developer Experience +devmode: #!/usr/bin/env bash CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"') @@ -67,11 +54,34 @@ devmode-on: if grep -q "bluefin-dx" <<< $CURRENT_IMAGE then - echo "You are already on a developer image" + CURRENT_STATE="enabled" else - echo "Rebasing to a developer image" - NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin/bluefin-dx/") - rpm-ostree rebase $NEW_IMAGE + CURRENT_STATE="disabled" + fi + + echo "Developer mode is currently ${CURRENT_STATE}" + echo "Enable or Disable developer mode" + OPTION=$(gum choose Enable Disable) + if [ "$OPTION" = "Enable" ] + then + if grep -q "bluefin-dx" <<< $CURRENT_IMAGE + then + echo "You are already on a developer image" + else + echo "Rebasing to a developer image" + NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin/bluefin-dx/") + rpm-ostree rebase $NEW_IMAGE + fi + elif [ "$OPTION" = "Disable" ] + then + if grep -q "bluefin-dx" <<< $CURRENT_IMAGE + then + echo "Rebasing to a non developer image" + NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin-dx/bluefin/") + rpm-ostree rebase $NEW_IMAGE + else + echo "You are currently not on a developer image" + fi fi # Assemble a Pytorch distrobox (Nvidia only) From a822d2f7be51752f3ff2b467aada3e2e20832ed7 Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Sun, 26 Nov 2023 20:00:12 +0100 Subject: [PATCH 2/2] chore: minor improvement --- just/custom.just | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/just/custom.just b/just/custom.just index b1979bd30f0..3008f0e2d67 100644 --- a/just/custom.just +++ b/just/custom.just @@ -34,10 +34,6 @@ cockpit: sudo systemctl enable cockpit.service echo 'Open Cockpit -> http://localhost:9090' -# Import a devcontainers profile for VSCode -code-profile: - xdg-open https://vscode.dev/profile/github/c761b7738e9a7b02286d6d94cb2d1ecd - # Toggle between Bluefin and the Developer Experience devmode: #!/usr/bin/env bash @@ -64,7 +60,7 @@ devmode: OPTION=$(gum choose Enable Disable) if [ "$OPTION" = "Enable" ] then - if grep -q "bluefin-dx" <<< $CURRENT_IMAGE + if [ "$CURRENT_STATE" = "enabled" ] then echo "You are already on a developer image" else @@ -74,7 +70,7 @@ devmode: fi elif [ "$OPTION" = "Disable" ] then - if grep -q "bluefin-dx" <<< $CURRENT_IMAGE + if [ "$CURRENT_STATE" = "enabled" ] then echo "Rebasing to a non developer image" NEW_IMAGE=$(echo $CURRENT_IMAGE | sed "s/bluefin-dx/bluefin/")