Skip to content

Commit

Permalink
chore: Clean up hardware & user setup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jan 30, 2024
1 parent 8909fd2 commit 57e583d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
10 changes: 5 additions & 5 deletions system_files/desktop/shared/usr/bin/bazzite-hardware-setup
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if [[ ! -f $INITRAMFS_REBUILD_TRIGGER ]]; then
if [[ -f $KNOWN_IMAGE_NAME_FILE && -f $KNOWN_IMAGE_FLAVOR_FILE && -f $KNOWN_FEDORA_VERSION_FILE && -f $KNOWN_IMAGE_BRANCH_FILE ]]; then
# Run script if image has been rebased
if [[ $IMAGE_NAME = "$KNOWN_IMAGE_NAME" && $IMAGE_FLAVOR = "$KNOWN_IMAGE_FLAVOR" && $FEDORA_VERSION = "$KNOWN_FEDORA_VERSION" && $IMAGE_BRANCH = "$KNOWN_IMAGE_BRANCH" ]]; then
echo "Hardware setup has already run. Exiting..."
echo "Hardware setup v$HWS_VER has already run. Exiting..."
exit 0
fi
fi
Expand Down Expand Up @@ -108,7 +108,7 @@ fi
# KERNEL ARGUMENTS
echo "Current kargs: $KARGS"

if [[ ":Jupiter:" =~ ":$SYS_ID:" || ":Galileo:" =~ ":$SYS_ID:" ]]; then
if /usr/libexec/hardware/valve-hardware; then
echo "Checking for needed karg changes (Jupiter/Galileo)"

if [[ ! $KARGS =~ "amd_iommu" ]]; then
Expand Down Expand Up @@ -139,7 +139,7 @@ if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
fi
fi

if [[ ":ROG Ally RC71L_RC71L:83E1:G1618-04:G1617-01:G1619-05:AIR Plus:" =~ ":$SYS_ID:" ]]; then
if /usr/libexec/hardware/hhd-supported-hardware; then
if [[ ! $KARGS =~ "iomem" ]]; then
echo "Adding needed kargs for ryzenadj"
NEEDED_KARGS+=("--append-if-missing=iomem=relaxed")
Expand Down Expand Up @@ -176,11 +176,11 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
systemctl enable --now vpower.service
else
echo "Generic device detected. Performing setup..."
if [[ ":ROG Ally RC71L_RC71L:83E1:G1618-04:G1617-01:G1619-05:AIR Plus:" =~ ":$SYS_ID:" ]]; then
if /usr/libexec/hardware/hhd-supported-hardware; then
echo "HHD supported handheld detected, disabling handycon & ds-inhibit..."
systemctl disable --now handycon.service
systemctl disable --now ds-inhibit.service
elif [[ ":AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1619-04:Win600:" =~ ":$SYS_ID:" ]]; then
elif /usr/libexec/hardware/handycon-supported-hardware; then
echo "HandyGCCS supported handheld detected, enabling handycon & ds-inhibit..."
systemctl enable --now handycon.service
systemctl enable --now ds-inhbit.service
Expand Down
12 changes: 7 additions & 5 deletions system_files/desktop/shared/usr/bin/bazzite-user-setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ IMAGE_INFO="/usr/share/ublue-os/image-info.json"
IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO)
BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO)
FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"

# INIT
BAZZITE_CONFIG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/bazzite"
Expand All @@ -14,6 +13,7 @@ mkdir -p "$BAZZITE_CONFIG_DIR"
USER_SETUP_VER=25
USER_SETUP_VER_FILE="$BAZZITE_CONFIG_DIR/version"
USER_SETUP_FEDORA_VER_FILE="$BAZZITE_CONFIG_DIR/fedora_version"
USER_SETUP_IMAGE_VER_FILE=$BAZZITE_CONFIG_DIR/image_name""

if [[ -f "$HOME/.bazzite-configured" ]]; then
mv -f "$HOME/.bazzite-configured" "$USER_SETUP_VER_FILE"
Expand All @@ -25,10 +25,11 @@ fi

USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
USER_SETUP_FEDORA_VER_RAN=$(cat $USER_SETUP_FEDORA_VER_FILE)
USER_SETUP_IMAGE_VER_RAN=$(cat $USER_SETUP_IMAGE_VER_FILE)

# Run script if updated
if [[ -f $USER_SETUP_VER_FILE && $USER_SETUP_VER = $USER_SETUP_VER_RAN ]]; then
if [[ -f $USER_SETUP_FEDORA_VER_FILE && $FEDORA_VERSION = $USER_SETUP_FEDORA_VER_RAN ]]; then
if [[ -f $USER_SETUP_FEDORA_VER_FILE && $FEDORA_VERSION = $USER_SETUP_FEDORA_VER_RAN && $BASE_IMAGE_NAME == USER_SETUP_IMAGE_VER_RAN ]]; then
echo "User setup v$USER_SETUP_VER has already run. Exiting..."
exit 0
fi
Expand Down Expand Up @@ -115,13 +116,13 @@ fi
# Deck Build Setup
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
# HHD Setup
if [[ "ROG Ally RC71L_RC71L:83E1:G1618-04:G1617-01:G1619-05:AIR Plus:" =~ ":$SYS_ID:" ]]; then
if /usr/libexec/hardware/hhd-supported-hardware; then
echo 'Enabling HHD'
pkexec /usr/libexec/bazzite-enable-hhd "$USER"
fi

# SDGyroDSU Setup
if [[ ":Jupiter:Galileo:" =~ ":$SYS_ID:" ]]; then
if /usr/libexec/hardware/valve-hardware; then
systemctl --user enable --now sdgyrodsu.service
else
systemctl --user disable --now sdgyrodsu.service
Expand All @@ -135,7 +136,7 @@ if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegam
rm -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop"
fi

if [[ ":ROG Ally RC71L_RC71L:83E1:Loki Max:G1618-04:" =~ ":$SYS_ID:" ]] && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
if /usr/libexec/rotation-fix-hardware && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
if [[ ! -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop" ]]; then
echo 'Adding rotation fix'
mkdir -p "$AUTOSTART_FOLDER/autostart"
Expand All @@ -151,3 +152,4 @@ fi
echo "Writing state file"
echo $USER_SETUP_VER > $USER_SETUP_VER_FILE
echo $FEDORA_VERSION > $USER_SETUP_FEDORA_VER_FILE
echo $BASE_IMAGE_NAME > $USER_SETUP_IMAGE_VER_FILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bash
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
if [[ ":AYANEO GEEK:AYANEO 2:AYANEO 2S:AOKZOE A1 AR07:G1619-04:Win600:" =~ ":$SYS_ID:" ]]; then
exit 0
else
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bash
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
if [[ ":ROG Ally RC71L_RC71L:83E1:G1618-04:G1617-01:G1619-05:AIR Plus:" =~ ":$SYS_ID:" ]]; then
exit 0
else
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bash
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
if [[ ":ROG Ally RC71L_RC71L:83E1:Loki Max:G1618-04:" =~ ":$SYS_ID:" ]]; then
exit 0
else
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/bash
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
if [[ ":Jupiter:Galileo:" =~ ":$SYS_ID:" ]]; then
exit 0
else
exit 1
fi

0 comments on commit 57e583d

Please sign in to comment.