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

chore(just): format justfiles #156

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 27 additions & 27 deletions build/ublue-os-just/00-default.just
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,55 @@
uid := `id -u`
shell := `grep :$(id -u): /etc/passwd | cut -d: -f7`

set allow-duplicate-recipes
set ignore-comments
set allow-duplicate-recipes := true
set ignore-comments := true

_default:
@just --unstable --list --list-heading $'Available commands:\n' --list-prefix $' - '
@just --unstable --list --list-heading $'Available commands:\n' --list-prefix $' - '

# Boot into this device's BIOS/UEFI screen
bios:
systemctl reboot --firmware-setup
systemctl reboot --firmware-setup

# Change the user's shell
chsh new_shell:
#!/usr/bin/env bash
set -euo pipefail
if [ "{{shell}}" = "{{new_shell}}" ] ; then
printf "Your shell is already set to %s.\n" "{{new_shell}}"
else
if [ -x "{{new_shell}}" ] ; then
sudo usermod $USER --shell "{{new_shell}}"
printf "%s's shell is now %s.\n" "$USER" "{{new_shell}}"
#!/usr/bin/env bash
set -euo pipefail
if [ "{{ shell }}" = "{{ new_shell }}" ] ; then
printf "Your shell is already set to %s.\n" "{{ new_shell }}"
else
echo "{{new_shell}} does not exist or is not executable!"
if [ -x "{{ new_shell }}" ] ; then
sudo usermod $USER --shell "{{ new_shell }}"
printf "%s's shell is now %s.\n" "$USER" "{{ new_shell }}"
else
echo "{{ new_shell }} does not exist or is not executable!"
fi
fi
fi

# Regenerate GRUB config, useful in dual-boot scenarios where a second operating system isn't listed
regenerate-grub:
#!/usr/bin/env bash
if [ -d /sys/firmware/efi ]; then
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
else
sudo grub2-mkconfig -o /etc/grub2.cfg
fi
#!/usr/bin/env bash
if [ -d /sys/firmware/efi ]; then
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
else
sudo grub2-mkconfig -o /etc/grub2.cfg
fi

# Show the changelog
changelogs:
rpm-ostree db diff --changelogs
rpm-ostree db diff --changelogs

# Enroll Nvidia driver & KMOD signing key for secure boot - Enter password "ublue-os" if prompted
enroll-secure-boot-key:
sudo mokutil --import /etc/pki/akmods/certs/akmods-ublue.der
echo 'Enter password "ublue-os" if prompted'
sudo mokutil --import /etc/pki/akmods/certs/akmods-ublue.der
echo 'Enter password "ublue-os" if prompted'

# 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
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
echo 'Uninstalling latest git snapshot of Distrobox...'
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/uninstall | sh -s -- --prefix ~/.local
62 changes: 31 additions & 31 deletions build/ublue-os-just/10-update.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@

# Update system, flatpaks, and containers all at once
update:
#!/usr/bin/env bash
if systemctl is-enabled ublue-update.timer | grep -q enabled;
then
echo "Starting the ublue-update service"
sudo systemctl start ublue-update.service
else
rpm-ostree update
flatpak update -y
distrobox upgrade -a
fi
#!/usr/bin/env bash
if systemctl is-enabled ublue-update.timer | grep -q enabled;
then
echo "Starting the ublue-update service"
sudo systemctl start ublue-update.service
else
rpm-ostree update
flatpak update -y
distrobox upgrade -a
fi

# Update device firmware
update-firmware:
fwupdmgr refresh --force
fwupdmgr get-updates
fwupdmgr update
fwupdmgr refresh --force
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
#!/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

# 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
fi
#!/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
fi
16 changes: 8 additions & 8 deletions build/ublue-os-just/20-clean.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Clean up old containers and flatpaks
clean-system:
#!/usr/bin/env bash
podman system prune -a
flatpak uninstall --unused
rpm-ostree cleanup -bm
if [ -x "$(command -v nix-store)" ]; then
nix-store --gc
nix-store --optimise
fi
#!/usr/bin/env bash
podman system prune -a
flatpak uninstall --unused
rpm-ostree cleanup -bm
if [ -x "$(command -v nix-store)" ]; then
nix-store --gc
nix-store --optimise
fi
54 changes: 27 additions & 27 deletions build/ublue-os-just/30-distrobox.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,57 @@

# Create an Arch container
distrobox-arch:
echo 'Creating Arch distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/arch-distrobox:latest -n arch -Y
echo 'Creating Arch distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/arch-distrobox:latest -n arch -Y

# Create a Bazzite-Arch container
distrobox-bazzite:
#!/usr/bin/env bash
echo 'Creating Bazzite distrobox ...'
if command -v /usr/bin/mutter > /dev/null; then
distrobox-create --unshare-netns --nvidia --image ghcr.io/ublue-os/bazzite-arch-gnome --name bazzite-arch -Y
else
distrobox-create --unshare-netns --nvidia --image ghcr.io/ublue-os/bazzite-arch --name bazzite-arch -Y
fi
echo 'Check out the docs for exportable apps and instructions: https://github.com/ublue-os/bazzite-arch'
#!/usr/bin/env bash
echo 'Creating Bazzite distrobox ...'
if command -v /usr/bin/mutter > /dev/null; then
distrobox-create --unshare-netns --nvidia --image ghcr.io/ublue-os/bazzite-arch-gnome --name bazzite-arch -Y
else
distrobox-create --unshare-netns --nvidia --image ghcr.io/ublue-os/bazzite-arch --name bazzite-arch -Y
fi
echo 'Check out the docs for exportable apps and instructions: https://github.com/ublue-os/bazzite-arch'

# Create an Alpine boxkit container
distrobox-boxkit:
echo 'Creating Boxkit distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/boxkit -n boxkit -Y
echo 'Creating Boxkit distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/boxkit -n boxkit -Y

# Create a Debian container
distrobox-debian:
echo 'Creating Debian distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/debian-toolbox:unstable -n debian -Y
echo 'Creating Debian distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/debian-toolbox:unstable -n debian -Y

# Create a Fedora container
distrobox-fedora:
echo 'Creating Fedora distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/fedora-distrobox:latest -n fedora -Y
echo 'Creating Fedora distrobox ...'
distrobox-create --nvidia --image ghcr.io/ublue-os/fedora-distrobox:latest -n fedora -Y

# Create an openSUSE container
distrobox-opensuse:
echo 'Creating openSUSE distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/opensuse-toolbox:tumbleweed -n opensuse -Y
echo 'Creating openSUSE distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/opensuse-toolbox:tumbleweed -n opensuse -Y

# Create an Ubuntu container
distrobox-ubuntu:
echo 'Creating Ubuntu distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y
echo 'Creating Ubuntu distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y

# Create an Alma Linux container
distrobox-alma:
echo 'Creating Alma distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/almalinux-toolbox:latest -n alma -Y
echo 'Creating Alma distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/almalinux-toolbox:latest -n alma -Y

# Create a Centos (Stream) container
distrobox-centos:
echo 'Creating Centos (Stream) distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/centos-toolbox:latest -n centos -Y
echo 'Creating Centos (Stream) distrobox ...'
distrobox-create --nvidia --image quay.io/toolbx-images/centos-toolbox:latest -n centos -Y

# Install obs-studio-portable from wimpysworld, which bundles an extensive collection of 3rd party plugins
install-obs-studio-portable:
echo 'Installing obs-studio-portable...' && \
distrobox-create --nvidia --no-entry --image ghcr.io/ublue-os/obs-studio-portable -n obs-studio-portable -Y && \
distrobox-enter -n obs-studio-portable -- 'bash -c "distrobox-export --app obs"'
echo 'Installing obs-studio-portable...' && \
distrobox-create --nvidia --no-entry --image ghcr.io/ublue-os/obs-studio-portable -n obs-studio-portable -Y && \
distrobox-enter -n obs-studio-portable -- 'bash -c "distrobox-export --app obs"'
74 changes: 37 additions & 37 deletions build/ublue-os-just/40-nvidia.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@

# Set needed kernel arguments for Nvidia GPUs
nvidia-set-kargs:
#!/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.'
fi
#!/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.'
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
#!/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".'
fi
#!/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".'
fi
32 changes: 16 additions & 16 deletions build/ublue-os-just/50-akmods.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

# Use stock gamepad drivers
use-stock-gamepads:
#!/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'
#!/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'

# Use uBlue gamepad drivers (Default)
use-ublue-gamepads:
#!/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
#!/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'
#!/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
#!/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
2 changes: 1 addition & 1 deletion build/ublue-os-just/60-custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

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