Skip to content

Commit

Permalink
feat(just): combine devmode on/off with gum (ublue-os#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobslept authored Nov 26, 2023
1 parent fc3ec34 commit e20624c
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions just/custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,8 @@ 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

# 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"')

Expand All @@ -67,11 +50,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 [ "$CURRENT_STATE" = "enabled" ]
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 [ "$CURRENT_STATE" = "enabled" ]
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)
Expand Down

0 comments on commit e20624c

Please sign in to comment.