Skip to content

Commit

Permalink
chore: pass the entire repo through shfmt and shellcheck (#315)
Browse files Browse the repository at this point in the history
These are mostly just cleanups for workarounds and things we dont need
anymore. This shouldnt change anything on the build
  • Loading branch information
tulilirockz authored Feb 22, 2025
1 parent 43733fd commit 699ab3c
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 204 deletions.
28 changes: 14 additions & 14 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ _rootful_load_image $target_image=image_name $tag=default_tag:
# target_image: The name of the image to build (ex. localhost/fedora)
# tag: The tag of the image to build (ex. latest)
# type: The type of image to build (ex. qcow2, raw, iso)
# config: The configuration file to use for the build (deafult: image-builder.config.toml)
# config: The configuration file to use for the build (default: image.toml)

# Example: just _rebuild-bib localhost/fedora latest qcow2 image-builder.config.toml
# Example: just _rebuild-bib localhost/fedora latest qcow2 image.toml
_build-bib $target_image $tag $type $config: (_rootful_load_image target_image tag)
#!/usr/bin/env bash
set -euo pipefail
Expand Down Expand Up @@ -220,34 +220,34 @@ _build-bib $target_image $tag $type $config: (_rootful_load_image target_image t
# target_image: The name of the image to build (ex. localhost/fedora)
# tag: The tag of the image to build (ex. latest)
# type: The type of image to build (ex. qcow2, raw, iso)
# config: The configuration file to use for the build (deafult: image-builder.config.toml)
# config: The configuration file to use for the build (deafult: image.toml)

# Example: just _rebuild-bib localhost/fedora latest qcow2 image-builder.config.toml
# Example: just _rebuild-bib localhost/fedora latest qcow2 image.toml
_rebuild-bib $target_image $tag $type $config: (build target_image tag) && (_build-bib target_image tag type config)

# Build a QCOW2 virtual machine image
[group('Build Virtal Machine Image')]
build-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "qcow2" "image-builder.config.toml")
build-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "qcow2" "image.toml")

# Build a RAW virtual machine image
[group('Build Virtal Machine Image')]
build-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "raw" "image-builder.config.toml")
build-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "raw" "image.toml")

# Build an ISO virtual machine image
[group('Build Virtal Machine Image')]
build-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "iso" "image-builder-iso.config.toml")
build-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_build-bib target_image tag "iso" "iso.toml")

# Rebuild a QCOW2 virtual machine image
[group('Build Virtal Machine Image')]
rebuild-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "qcow2" "image-builder.config.toml")
rebuild-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "qcow2" "image.toml")

# Rebuild a RAW virtual machine image
[group('Build Virtal Machine Image')]
rebuild-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "raw" "image-builder.config.toml")
rebuild-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "raw" "image.toml")

# Rebuild an ISO virtual machine image
[group('Build Virtal Machine Image')]
rebuild-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "iso" "image-builder-iso.config.toml")
rebuild-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_rebuild-bib target_image tag "iso" "iso.toml")

# Run a virtual machine with the specified image type and configuration
_run-vm $target_image $tag $type $config:
Expand Down Expand Up @@ -294,15 +294,15 @@ _run-vm $target_image $tag $type $config:

# Run a virtual machine from a QCOW2 image
[group('Run Virtal Machine')]
run-vm-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "qcow2" "image-builder.config.toml")
run-vm-qcow2 $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "qcow2" "image.toml")

# Run a virtual machine from a RAW image
[group('Run Virtal Machine')]
run-vm-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "raw" "image-builder.config.toml")
run-vm-raw $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "raw" "image.toml")

# Run a virtual machine from an ISO
[group('Run Virtal Machine')]
run-vm-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "iso" "image-builder-iso.config.toml")
run-vm-iso $target_image=("localhost/" + image_name) $tag=default_tag: && (_run-vm target_image tag "iso" "iso.toml")

# Run a virtual machine using systemd-vmspawn
[group('Run Virtal Machine')]
Expand Down Expand Up @@ -339,7 +339,7 @@ customize-iso-build:
--pull=newer \
--net=host \
--security-opt label=type:unconfined_t \
-v $(pwd)/image-builder-iso.config.toml \
-v $(pwd)/iso.toml \
-v $(pwd)/output:/output \
-v /var/lib/containers/storage:/var/lib/containers/storage \
--entrypoint "" \
Expand Down
6 changes: 3 additions & 3 deletions build_scripts/00-workarounds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ set -xeuo pipefail
# have strict NVR requirements.
curl --retry 3 -Lo "/etc/yum.repos.d/compose.repo" "https://gitlab.com/redhat/centos-stream/containers/bootc/-/raw/c${MAJOR_VERSION_NUMBER}s/cs.repo"
sed -i \
-e "s@- (BaseOS|AppStream)@& - Compose@" \
-e "s@\(baseos\|appstream\)@&-compose@" \
/etc/yum.repos.d/compose.repo
-e "s@- (BaseOS|AppStream)@& - Compose@" \
-e "s@\(baseos\|appstream\)@&-compose@" \
/etc/yum.repos.d/compose.repo
5 changes: 2 additions & 3 deletions build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ copy_systemfiles_for() {
}

MAJOR_VERSION_NUMBER="$(sh -c '. /usr/lib/os-release ; echo $VERSION_ID')"
SCRIPTS_PATH="$(realpath "$(dirname $0)/scripts")"
SCRIPTS_PATH="$(realpath "$(dirname "$0")/scripts")"
export SCRIPTS_PATH
export MAJOR_VERSION_NUMBER

Expand All @@ -48,7 +48,7 @@ if [ "$ENABLE_DX" == "1" ]; then
run_buildscripts_for "$(arch)/dx"
fi

if [ "$ENABLE_GDX" == "1" ] ; then
if [ "$ENABLE_GDX" == "1" ]; then
# We explicitly only support x86 on nvidia (unless they update it?)
copy_systemfiles_for "gdx"
copy_systemfiles_for "x86_64-gdx"
Expand All @@ -62,7 +62,6 @@ if [ "$ENABLE_HWE" == "1" ]; then
run_buildscripts_for "$(arch)/hwe"
fi


printf "::group:: ===Image Cleanup===\n"
# Ensure these get run at the _end_ of the build no matter what
/var/tmp/build_scripts/cleanup.sh
Expand Down
2 changes: 1 addition & 1 deletion build_scripts/overrides/aarch64/00-flatpaks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ set -xeuo pipefail
TARGET_FLATPAK_FILE="/etc/ublue-os/system-flatpaks.list"

sed -i "/org\.mozilla.*/d" "$TARGET_FLATPAK_FILE"
echo "org.chromium.Chromium" >> "$TARGET_FLATPAK_FILE"
echo "org.chromium.Chromium" >>"$TARGET_FLATPAK_FILE"

sed -i "s/org.mozilla.Firefox/org.chromium.Chromium/g" /usr/share/glib-2.0/schemas/zz0-bluefin-modifications.gschema.override
2 changes: 1 addition & 1 deletion build_scripts/overrides/dx/05-dconf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ cat >/usr/share/glib-2.0/schemas/zz1-dx-modifications.gschema.override <<EOF
show-boxbuddy=true
EOF

echo "io.github.dvlv.boxbuddyrs" >> /etc/ublue-os/system-flatpaks.list
echo "io.github.dvlv.boxbuddyrs" >>/etc/ublue-os/system-flatpaks.list
16 changes: 9 additions & 7 deletions build_scripts/overrides/x86_64/gdx/20-nvidia.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ NVIDIA_DRIVER_DIRECTORY=$(mktemp -d)
NVIDIA_DRIVER_FLAVOR=nvidia-open

# EGL-gbm and EGL-wayland fail to install because of conflicts with each other
dnf download egl-gbm egl-wayland --destdir=$NVIDIA_DRIVER_DIRECTORY
rpm -ivh $NVIDIA_DRIVER_DIRECTORY/*.rpm --nodeps --force
dnf download egl-gbm egl-wayland --destdir="$NVIDIA_DRIVER_DIRECTORY"
rpm -ivh "$NVIDIA_DRIVER_DIRECTORY"/*.rpm --nodeps --force

dnf -y install --nogpgcheck \
-x egl-wayland \
-x egl-gbm \
nvidia-driver{,-cuda} kmod-$NVIDIA_DRIVER_FLAVOR-dkms
-x egl-wayland \
-x egl-gbm \
nvidia-driver{,-cuda} "kmod-$NVIDIA_DRIVER_FLAVOR-dkms"

KERNEL_SUFFIX=""
QUALIFIED_KERNEL="$(rpm -qa | grep -P 'kernel-(|'"$KERNEL_SUFFIX"'-)(\d+\.\d+\.\d+)' | sed -E 's/kernel-(|'"$KERNEL_SUFFIX"'-)//')"
Expand All @@ -43,8 +43,8 @@ install -Dm0755 /tmp/fake-uname /tmp/bin/uname

NVIDIA_DRIVER_VERSION=$(rpm -q "nvidia-driver" --queryformat '%{VERSION}')
# PATH modification for fake-uname
PATH=/tmp/bin:$PATH dkms --force install -m $NVIDIA_DRIVER_FLAVOR -v $NVIDIA_DRIVER_VERSION -k $QUALIFIED_KERNEL
cat /var/lib/dkms/nvidia-open/$NVIDIA_DRIVER_VERSION/build/make.log || echo "Expected failure"
PATH=/tmp/bin:$PATH dkms --force install -m "$NVIDIA_DRIVER_FLAVOR" -v "$NVIDIA_DRIVER_VERSION" -k "$QUALIFIED_KERNEL"
cat "/var/lib/dkms/nvidia-open/$NVIDIA_DRIVER_VERSION/build/make.log" || echo "Expected failure"

cat >/usr/lib/modprobe.d/00-nouveau-blacklist.conf <<EOF
blacklist nouveau
Expand All @@ -56,5 +56,7 @@ kargs = ["rd.driver.blacklist=nouveau", "modprobe.blacklist=nouveau", "nvidia-dr
match-architectures = ["x86_64"]
EOF

dnf -y remove kernel-devel kernel-devel-matched kernel-headers dkms gcc-c++

# Make sure initramfs is rebuilt after nvidia drivers or kernel replacement
/usr/bin/dracut --no-hostonly --kver "$QUALIFIED_KERNEL" --reproducible --zstd -v -f
File renamed without changes.
File renamed without changes.

This file was deleted.

162 changes: 0 additions & 162 deletions system_files/usr/share/containers/storage.conf

This file was deleted.

10 changes: 5 additions & 5 deletions system_files/usr/share/fish/vendor_functions.d/fish_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ function fish_prompt --description 'Default prompt with container detection'
end
set suffix '#'
end

# Detect if we are in a container
if test -n "$CONTAINER_ID"
set -g prompt_host "[$CONTAINER_ID]"
set -g prefix_icon "📦 "
else
set -g prompt_host "$hostname"
set -g prefix_icon ""
else
set -g prompt_host "$hostname"
set -g prefix_icon ""
end

# Write pipestatus
Expand All @@ -38,4 +38,4 @@ function fish_prompt --description 'Default prompt with container detection'
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)

echo -n -s $prefix_icon (set_color $fish_color_user) "$USER" $normal "@" $prompt_host' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " "
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi
UBLUE_CONFIG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/ublue"
mkdir -p "$UBLUE_CONFIG_DIR"

if [[ ":Framework:" =~ ":$VEN_ID:" ]]; then
if [[ ":Framework:" =~ :$VEN_ID: ]]; then
if [[ ! -f "$UBLUE_CONFIG_DIR/framework-initialized" ]]; then
echo 'Setting Framework logo menu'
dconf write /org/gnome/shell/extensions/Logo-menu/symbolic-icon true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [[ $KARGS =~ "nomodeset" ]]; then
NEEDED_KARGS+=("--delete-if-present=nomodeset")
fi

if [[ ":Framework:" =~ ":$VEN_ID:" ]]; then
if [[ ":Framework:" =~ :$VEN_ID: ]]; then
if [[ "GenuineIntel" == "$CPU_VENDOR" ]]; then
if [[ ! $KARGS =~ "hid_sensor_hub" ]]; then
echo "Intel Framework Laptop detected, applying needed keyboard fix"
Expand All @@ -38,7 +38,7 @@ fi
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"

# FRAMEWORK 13 AMD FIXES
if [[ ":Framework:" =~ ":$VEN_ID:" ]]; then
if [[ ":Framework:" =~ :$VEN_ID: ]]; then
if [[ $SYS_ID == "Laptop 13 ("* ]]; then
if [[ "AuthenticAMD" == "$CPU_VENDOR" ]]; then
if [[ ! -f /etc/modprobe.d/alsa.conf ]]; then
Expand Down

0 comments on commit 699ab3c

Please sign in to comment.