From 13998711acad7c538080bc8bb134e9ed141ace9e Mon Sep 17 00:00:00 2001
From: HikariKnight <2557889+HikariKnight@users.noreply.github.com>
Date: Fri, 12 Jan 2024 16:24:24 +0100
Subject: [PATCH] feat(just): combine several just commands into toggles or
choices (#181)
* chore: merge install/remove-distrobox-git
* chore: merge enable/disable-updates
* chore: correct wording in description of distrobox-git
* chore(just): merge ublue/stock-gamepads and enable/disable-broadcom-wl
* chore(just): combine and merge all the nix recipes
* chore(just): remove empty lines that were used for readability while writing the just recipes
* chore(just): remove leftover spaces from before reorg
* chore(just): improve description wording for setup-distrobox-git and change brew-remove to remove-brew
* chore(just): format the message for configure-gamepads to look better
* chore(just): change gamepad description to be more clear
* chore(just): merge nvidia recipes into configure-nvidia
* chore(just): change fixscreenshare to fix-screenshare to conform with naming scheme
* chore(just): add some bold text for title or install state
* feat(just): add quick options for use in yafti
* chore(just): fix formating for just
* chore(just): add missing quick options for setup-nix
* chore(just): add aliases for recipes
* chore(just): add empty line between alias and recipe description
* chore(just): added missing empty line for upgrade alias
* chore: Always use #!/usr/bin/bash
* chore(just): fix conditions to be lowercase for enable/disable and install/remove
* chore(just): standardize choice recipe ARG as ACTION
* feat(just): add toggle-nvk, addresses #182
* chore(just): Add message about what to do after running enroll-secure-boot-key
---
build/ublue-os-just/00-default.just | 32 ++--
build/ublue-os-just/10-update.just | 59 ++++---
build/ublue-os-just/20-clean.just | 2 +-
build/ublue-os-just/30-distrobox.just | 2 +-
build/ublue-os-just/40-nvidia.just | 107 +++++++-----
build/ublue-os-just/50-akmods.just | 84 ++++++---
build/ublue-os-just/60-custom.just | 2 +-
build/ublue-os-just/70-nix.just | 241 +++++++++++++++-----------
8 files changed, 328 insertions(+), 201 deletions(-)
diff --git a/build/ublue-os-just/00-default.just b/build/ublue-os-just/00-default.just
index b29a59bc..45c561f0 100644
--- a/build/ublue-os-just/00-default.just
+++ b/build/ublue-os-just/00-default.just
@@ -9,7 +9,7 @@ bios:
# Change the user's shell
chsh new_shell:
- #!/usr/bin/env bash
+ #!/usr/bin/bash
set -euo pipefail
if [ "{{ shell }}" = "{{ new_shell }}" ] ; then
printf "Your shell is already set to %s.\n" "{{ new_shell }}"
@@ -24,7 +24,7 @@ chsh new_shell:
# Regenerate GRUB config, useful in dual-boot scenarios where a second operating system isn't listed
regenerate-grub:
- #!/usr/bin/env bash
+ #!/usr/bin/bash
if [ -d /sys/firmware/efi ]; then
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
else
@@ -39,18 +39,26 @@ changelogs:
enroll-secure-boot-key:
echo 'Enter password "ublue-os" if prompted after your user password.'
sudo mokutil --import /etc/pki/akmods/certs/akmods-ublue.der --timeout -1
+ echo 'When you reboot your computer, follow the instructions to start MOK util'
+ echo 'by pressing a key, then enroll the secure boot key and enter "ublue-os" as the password'
-# Upgrade Distrobox to the latest git version
-distrobox-git:
- echo 'Installing latest git snapshot of Distrobox...'
- curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --next --prefix ~/.local
-
-# Downgrades Distrobox to the Fedora version
-remove-distrobox-git:
- echo 'Uninstalling latest git snapshot of Distrobox...'
- curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sh -s -- --prefix ~/.local
+# Install or uninstall distrobox-git
+setup-distrobox-git:
+ #!/usr/bin/bash
+ echo 'Which version of Distrobox do you want to use?'
+ OPTION=$(ugum choose "Latest distrobox-git snapshot" "uBlue provided version")
+ if [ "$OPTION" == "Latest distrobox-git snapshot" ]; then
+ echo 'Installing latest git snapshot of Distrobox...'
+ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --next --prefix ~/.local
+ elif [ "$OPTION" == "uBlue provided version" ]; then
+ echo 'Uninstalling latest git snapshot of Distrobox...'
+ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sh -s -- --prefix ~/.local
+ else
+ echo 'Cancelling...'
+ exit 0
+ fi
# Removes homebrew from system
-brew-remove:
+remove-brew:
echo "Removing homebrew ..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
diff --git a/build/ublue-os-just/10-update.just b/build/ublue-os-just/10-update.just
index cec39782..96e1f14e 100644
--- a/build/ublue-os-just/10-update.just
+++ b/build/ublue-os-just/10-update.just
@@ -1,8 +1,10 @@
# vim: set ft=make :
+alias upgrade := update
+
# Update system, flatpaks, and containers all at once
update VERB_LEVEL="full":
- #!/usr/bin/env bash
+ #!/usr/bin/bash
if systemctl is-enabled ublue-update.timer | grep -q enabled;
then
echo "Starting the ublue-update service"
@@ -73,26 +75,39 @@ update-firmware:
fwupdmgr get-updates
fwupdmgr update
-# Disable all auto-update timers
-disable-updates:
- #!/usr/bin/env bash
- if systemctl is-enabled ublue-update.timer | grep -q enabled;
- then
- sudo systemctl disable ublue-update.timer
- elif systemctl is-enabled flatpak-system-update.timer | grep -q enabled;
- then
- sudo systemctl disable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
- systemctl disable --now --user flatpak-user-update.timer
- fi
+alias auto-update := toggle-updates
-# Enable all auto-update timers
-enable-updates:
- #!/usr/bin/env bash
- if systemctl is-enabled ublue-update.timer | grep -q disabled;
- then
- sudo systemctl enable ublue-update.timer
- elif systemctl is-enabled flatpak-system-update.timer | grep -q disabled;
- then
- sudo systemctl enable --now flatpak-system-update.timer rpm-ostreed-automatic.timer
- systemctl enable --now --user flatpak-user-update.timer
+# Turn automatic updates on or off
+toggle-updates ACTION="prompt":
+ #!/usr/bin/bash
+ CURRENT_STATE="Disabled"
+ if systemctl is-enabled ublue-update.timer | grep -q enabled; then
+ CURRENT_STATE="Enabled"
+ fi
+ bold=$(tput bold)
+ normal=$(tput sgr0)
+ OPTION={{ ACTION }}
+ if [ "$OPTION" == "prompt" ]; then
+ echo "Automatic updates are currently: ${bold}${CURRENT_STATE}${normal}"
+ echo "Enable or Disable automatic updates?"
+ OPTION=$(ugum choose Enable Disable)
+ elif [ "$OPTION" == "help" ]; then
+ echo "Usage: ujust toggle-updates