Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(just): combine several just commands into toggles or choices #181

Merged
merged 25 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
dab6274
chore: merge install/remove-distrobox-git
HikariKnight Jan 1, 2024
0d3f825
chore: merge enable/disable-updates
HikariKnight Jan 1, 2024
df095c1
chore: correct wording in description of distrobox-git
HikariKnight Jan 2, 2024
8b1067f
chore(just): merge ublue/stock-gamepads and enable/disable-broadcom-wl
HikariKnight Jan 2, 2024
b4afea2
chore(just): combine and merge all the nix recipes
HikariKnight Jan 2, 2024
0f46c73
chore(just): remove empty lines that were used for readability while …
HikariKnight Jan 2, 2024
b093094
chore(just): remove leftover spaces from before reorg
HikariKnight Jan 2, 2024
d15fd0a
chore(just): improve description wording for setup-distrobox-git and …
HikariKnight Jan 2, 2024
3dc413f
chore(just): format the message for configure-gamepads to look better
HikariKnight Jan 2, 2024
2f20dfc
chore(just): change gamepad description to be more clear
HikariKnight Jan 2, 2024
8269fd8
chore(just): merge nvidia recipes into configure-nvidia
HikariKnight Jan 3, 2024
8b3eb56
chore(just): change fixscreenshare to fix-screenshare to conform with…
HikariKnight Jan 3, 2024
d3e6398
chore(just): add some bold text for title or install state
HikariKnight Jan 4, 2024
12d8421
feat(just): add quick options for use in yafti
HikariKnight Jan 7, 2024
a1ca04a
chore(just): fix formating for just
HikariKnight Jan 7, 2024
430c840
chore(just): add missing quick options for setup-nix
HikariKnight Jan 7, 2024
c6cb6e6
chore(just): add aliases for recipes
HikariKnight Jan 7, 2024
8868c01
chore(just): add empty line between alias and recipe description
HikariKnight Jan 7, 2024
762c3ff
chore(just): added missing empty line for upgrade alias
HikariKnight Jan 7, 2024
23cca16
chore: Always use #!/usr/bin/bash
HikariKnight Jan 8, 2024
885361f
chore(just): fix conditions to be lowercase for enable/disable and in…
HikariKnight Jan 8, 2024
dee99ef
chore(just): standardize choice recipe ARG as ACTION
HikariKnight Jan 10, 2024
195893f
feat(just): add toggle-nvk, addresses #182
HikariKnight Jan 11, 2024
d068b2d
chore(just): Add message about what to do after running enroll-secure…
HikariKnight Jan 11, 2024
a0bad96
Merge branch 'main' into HikariKnight-just-reorg
HikariKnight Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions build/ublue-os-just/00-default.just
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,23 @@ 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

# 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/env 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)"
51 changes: 31 additions & 20 deletions build/ublue-os-just/10-update.just
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,37 @@ update-firmware:
fwupdmgr get-updates
fwupdmgr update

# Disable all auto-update timers
disable-updates:
# Turn automatic updates on or off
toggle-updates ARG="prompt":
#!/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
CURRENT_STATE="Disabled"
if systemctl is-enabled ublue-update.timer | grep -q enabled; then
CURRENT_STATE="Enabled"
fi

# 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
bold=$(tput bold)
normal=$(tput sgr0)
OPTION={{ ARG }}
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 <option>"
echo " <option>: Specify the quick option - 'enable' or 'disable'"
echo " Use 'enable' to Enable automatic updates."
echo " Use 'disable' to Disable automatic updates."
exit 0
fi
if [ "${OPTION,,}" == "Enable" ]; then
sudo systemctl enable ublue-update.timer
if 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
fi
elif [ "${OPTION,,}" == "Disable" ]; then
sudo systemctl disable ublue-update.timer
if 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
fi
95 changes: 53 additions & 42 deletions build/ublue-os-just/40-nvidia.just
Original file line number Diff line number Diff line change
@@ -1,47 +1,58 @@
# vim: set ft=make :

# Set needed kernel arguments for Nvidia GPUs
nvidia-set-kargs:
# Configure the Nvidia driver
configure-nvidia ARG="prompt":
#!/usr/bin/env bash
if command -v nvidia-smi; then
rpm-ostree kargs \
--append-if-missing=rd.driver.blacklist=nouveau \
--append-if-missing=modprobe.blacklist=nouveau \
--append-if-missing=nvidia-drm.modeset=1 \
--delete-if-present=nomodeset
else
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.'
bold=$(tput bold)
normal=$(tput sgr0)
OPTION={{ ARG }}
if [ "$OPTION" == "prompt" ]; then
echo "${bold}Configuring Nvidia drivers${normal}"
echo 'What would you like to do?'
OPTION=$(ugum choose "Set needed kernel arguments" "Test CUDA support" "Enable Nvidia VAAPI in Firefox Flatpak")
elif [ "$OPTION" == "help" ]; then
echo "Usage: ujust configure-nvidia <option>"
echo " <option>: Specify the quick option - 'kargs', 'test-cuda' or 'firefox-vaapi'"
echo " Use 'kargs' to Set needed kernel arguments"
echo " Use 'test-cuda' to Test CUDA support"
echo " Use 'firefox-vaapi' to Enable Nvidia VAAPI in Firefox Flatpak."
exit 0
fi

# Test CUDA support for Nvidia GPUs
nvidia-test-cuda:
#!/usr/bin/env bash
if lsmod | grep -wq "nvidia"; then
podman run \
--user 1000:1000 \
--security-opt=no-new-privileges \
--cap-drop=ALL \
--security-opt label=type:nvidia_container_t \
--device=nvidia.com/gpu=all \
docker.io/nvidia/samples:vectoradd-cuda11.2.1
else
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

# Enable VAAPI in Firefox Flatpak for Nvidia GPUs
nvidia-setup-firefox-vaapi:
#!/usr/bin/env bash
if lsmod | grep -wq "nvidia"; then
flatpak override \
--user \
--filesystem=host-os \
--env=LIBVA_DRIVER_NAME=nvidia \
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \
--env=LIBVA_MESSAGING_LEVEL=1 \
--env=MOZ_DISABLE_RDD_SANDBOX=1 \
--env=NVD_BACKEND=direct \
--env=MOZ_ENABLE_WAYLAND=1 \
org.mozilla.firefox
else
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".'
if [ "$OPTION" == "Set needed kernel arguments" ] || [ "${OPTION,,}" == "kargs" ]; then
if command -v nvidia-smi; then
rpm-ostree kargs \
--append-if-missing=rd.driver.blacklist=nouveau \
--append-if-missing=modprobe.blacklist=nouveau \
--append-if-missing=nvidia-drm.modeset=1 \
--delete-if-present=nomodeset
else
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.'
fi
elif [ "$OPTION" == "Test CUDA support" ] || [ "${OPTION,,}" == "test-cuda" ]; then
if lsmod | grep -wq "nvidia"; then
podman run \
--user 1000:1000 \
--security-opt=no-new-privileges \
--cap-drop=ALL \
--security-opt label=type:nvidia_container_t \
--device=nvidia.com/gpu=all \
docker.io/nvidia/samples:vectoradd-cuda11.2.1
else
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
elif [ "$OPTION" == "Enable Nvidia VAAPI in Firefox Flatpak" ] || [ "${OPTION,,}" == "firefox-vaapi" ]; then
if lsmod | grep -wq "nvidia"; then
flatpak override \
--user \
--filesystem=host-os \
--env=LIBVA_DRIVER_NAME=nvidia \
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \
--env=LIBVA_MESSAGING_LEVEL=1 \
--env=MOZ_DISABLE_RDD_SANDBOX=1 \
--env=NVD_BACKEND=direct \
--env=MOZ_ENABLE_WAYLAND=1 \
org.mozilla.firefox
else
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
80 changes: 56 additions & 24 deletions build/ublue-os-just/50-akmods.just
Original file line number Diff line number Diff line change
@@ -1,29 +1,61 @@
# vim: set ft=make :

# Use stock gamepad drivers
use-stock-gamepads:
# Configure gamepad drivers
configure-gamepads ARG="prompt":
#!/usr/bin/env bash
sudo bash -c '> /etc/modprobe.d/xone.conf'
sudo bash -c '> /etc/modprobe.d/xpadneo.conf'
sudo bash -c '> /etc/modprobe.d/xpad-noone-blacklist.conf'
sudo bash -c '> /etc/modules-load.d/xpad-noone.conf'
bold=$(tput bold)
normal=$(tput sgr0)
OPTION={{ ARG }}
if [ "$OPTION" == "prompt" ]; then
echo "${bold}Configuring gamepad drivers${normal}"
echo 'Which drivers do you want to use?'
echo 'Note: Enabling xone and xpadneo can break some 3rd party controllers'
OPTION=$(ugum choose "Default Fedora drivers" "Enable xone and xpadneo")
elif [ "$OPTION" == "help" ]; then
echo "Usage: ujust configure-gamepads <option>"
echo " <option>: Specify the quick option - 'stock' or 'ublue'"
echo " Use 'stock' to select Default Fedora Drivers"
echo " Use 'ublue' to select Enable xone and xpadneo"
exit 0
fi
if [ "$OPTION" == "Enable xone and xpadneo" ] || [ "$OPTION" == "ublue" ]; then
sudo rm -f /etc/modprobe.d/xone.conf
sudo rm -f /etc/modprobe.d/xpadneo.conf
sudo rm -f /etc/modprobe.d/xpad-noone-blacklist.conf
sudo rm -f /etc/modules-load.d/xpad-noone.conf
echo "${bold}Enabled${normal} xone and xpadneo, please reboot for changes to take effect"
elif [ "$OPTION" == "Default Fedora drivers" ] || [ "$OPTION" == "stock" ]; then
sudo bash -c '> /etc/modprobe.d/xone.conf'
sudo bash -c '> /etc/modprobe.d/xpadneo.conf'
sudo bash -c '> /etc/modprobe.d/xpad-noone-blacklist.conf'
sudo bash -c '> /etc/modules-load.d/xpad-noone.conf'
echo "${bold}Disabled${normal} xone and xpadneo, please reboot for changes to take effect"
fi

# Use uBlue gamepad drivers (Default)
use-ublue-gamepads:
# Configure Broadcom WL driver (Enabling WL breaks numerous other Wi-Fi adapters)
configure-broadcom-wl ARG="prompt":
#!/usr/bin/env bash
sudo rm -f /etc/modprobe.d/xone.conf
sudo rm -f /etc/modprobe.d/xpadneo.conf
sudo rm -f /etc/modprobe.d/xpad-noone-blacklist.conf
sudo rm -f /etc/modules-load.d/xpad-noone.conf

# Disable Broadcom WL driver (Default - WL breaks numerous other Wi-Fi adapters)
disable-broadcom-wl:
#!/usr/bin/env bash
sudo bash -c '> /etc/modules-load.d/broadcom-wl-blacklist.conf'
sudo bash -c 'echo "blacklist wl" > /etc/modules-load.d/default-disable-broadcom-wl.conf'

# Use Broadcom WL driver
use-broadcom-wl:
#!/usr/bin/env bash
sudo rm -f /etc/modprobe.d/broadcom-wl-blacklist.conf
sudo rm -f /etc/modprobe.d/default-disable-broadcom-wl.conf
bold=$(tput bold)
normal=$(tput sgr0)
OPTION={{ ARG }}
if [ "$OPTION" == "prompt" ]; then
echo "${bold}Configuring Broadcom Wi-Fi${normal}"
echo 'Enabling Broadcom WL driver will break numerous other Wi-Fi adapters.'
echo 'Enable or Disable Broadcom Wl?'
OPTION=$(ugum choose Enable Disable)
elif [ "$OPTION" == "help" ]; then
echo "Usage: ujust configure-broadcom-wl <option>"
echo " <option>: Specify the quick option - 'enable' or 'disable'"
echo " Use 'enable' to select Enable"
echo " Use 'disable' to select Disable"
exit 0
fi
if [ "${OPTION,,}" == "enable" ]; then
sudo rm -f /etc/modprobe.d/broadcom-wl-blacklist.conf
sudo rm -f /etc/modprobe.d/default-disable-broadcom-wl.conf
echo "${bold}Enabled${normal} Broadcom Wireless, please reboot for changes to take effect"
elif [ "${OPTION,,}" == "disable" ]; then
sudo bash -c '> /etc/modules-load.d/broadcom-wl-blacklist.conf'
sudo bash -c 'echo "blacklist wl" > /etc/modules-load.d/default-disable-broadcom-wl.conf'
echo "${bold}Disabled${normal} Broadcom Wireless, please reboot for changes to take effect"
fi
2 changes: 1 addition & 1 deletion build/ublue-os-just/60-custom.just
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vim: set ft=make :

# Enable xwaylandvideobridge
fixscreenshare:
fix-screenshare:
cp /usr/share/applications/org.kde.xwaylandvideobridge.desktop $HOME/.config/autostart/
Loading