2023-12-22 19:22:29 -08:00
|
|
|
#!/usr/bin/bash
|
2023-09-22 11:59:29 -06:00
|
|
|
|
2023-10-13 14:33:43 -07:00
|
|
|
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)
|
|
|
|
|
2024-01-06 00:16:39 -08:00
|
|
|
# INIT
|
|
|
|
BAZZITE_CONFIG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/bazzite"
|
|
|
|
mkdir -p "$BAZZITE_CONFIG_DIR"
|
|
|
|
|
2023-09-27 15:56:19 -07:00
|
|
|
# SCRIPT VERSION
|
2024-01-30 17:27:24 -08:00
|
|
|
USER_SETUP_VER=28
|
2024-01-06 00:16:39 -08:00
|
|
|
USER_SETUP_VER_FILE="$BAZZITE_CONFIG_DIR/version"
|
|
|
|
USER_SETUP_FEDORA_VER_FILE="$BAZZITE_CONFIG_DIR/fedora_version"
|
2024-01-29 16:17:30 -08:00
|
|
|
USER_SETUP_IMAGE_VER_FILE=$BAZZITE_CONFIG_DIR/image_name""
|
2024-01-06 00:16:39 -08:00
|
|
|
|
|
|
|
if [[ -f "$HOME/.bazzite-configured" ]]; then
|
|
|
|
mv -f "$HOME/.bazzite-configured" "$USER_SETUP_VER_FILE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -f "$HOME/.bazzite-configured-fedora-version" ]]; then
|
|
|
|
mv -f "$HOME/.bazzite-configured-fedora-version" "$USER_SETUP_FEDORA_VER_FILE"
|
|
|
|
fi
|
|
|
|
|
2023-09-27 15:56:19 -07:00
|
|
|
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
|
2023-10-16 15:37:44 -06:00
|
|
|
USER_SETUP_FEDORA_VER_RAN=$(cat $USER_SETUP_FEDORA_VER_FILE)
|
2024-01-29 16:17:30 -08:00
|
|
|
USER_SETUP_IMAGE_VER_RAN=$(cat $USER_SETUP_IMAGE_VER_FILE)
|
2023-09-27 15:56:19 -07:00
|
|
|
|
|
|
|
# Run script if updated
|
|
|
|
if [[ -f $USER_SETUP_VER_FILE && $USER_SETUP_VER = $USER_SETUP_VER_RAN ]]; then
|
2024-01-29 16:17:30 -08:00
|
|
|
if [[ -f $USER_SETUP_FEDORA_VER_FILE && $FEDORA_VERSION = $USER_SETUP_FEDORA_VER_RAN && $BASE_IMAGE_NAME == USER_SETUP_IMAGE_VER_RAN ]]; then
|
2024-01-06 00:16:39 -08:00
|
|
|
echo "User setup v$USER_SETUP_VER has already run. Exiting..."
|
2023-10-13 14:33:43 -07:00
|
|
|
exit 0
|
|
|
|
fi
|
2023-09-27 15:56:19 -07:00
|
|
|
fi
|
|
|
|
|
2023-10-20 13:56:21 -07:00
|
|
|
# Enable Flathub
|
|
|
|
if grep -qz 'fedora' <<< $(flatpak remotes); then
|
|
|
|
flatpak remote-delete --user fedora --force
|
|
|
|
fi
|
2024-01-29 21:36:18 -08:00
|
|
|
flatpak remote-add --if-not-exists --user flathub /usr/etc/flatpak/remotes.d/flathub.flatpakrepo
|
2024-01-29 23:18:07 -08:00
|
|
|
flatpak remote-modify --user --enable --prio=2 flathub
|
2023-10-20 13:56:21 -07:00
|
|
|
|
|
|
|
# Handle privileged tasks
|
2023-11-03 19:54:30 -07:00
|
|
|
pkexec /usr/libexec/bazzite-privileged-user-setup
|
2023-10-20 13:56:21 -07:00
|
|
|
|
2024-01-28 11:41:52 -08:00
|
|
|
# Refresh fontconfig
|
|
|
|
if [[ -f "$HOME/.config/fontconfig" ]]; then
|
|
|
|
rm -rf "$HOME/.config/fontconfig"
|
|
|
|
fi
|
|
|
|
|
2023-12-19 10:30:13 -08:00
|
|
|
# Set up optional Gradience themes
|
2024-01-30 17:27:24 -08:00
|
|
|
GRADIENCE_THEME_DIR="/usr/etc/skel/.var/app/com.github.GradienceTeam.Gradience/config/presets/user"
|
2024-01-06 00:16:39 -08:00
|
|
|
GRADIENCE_DIR="$HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user"
|
|
|
|
mkdir -p "$GRADIENCE_DIR"
|
|
|
|
if [[ ! -f "$GRADIENCE_DIR/vapor.json" ]]; then
|
2024-01-30 17:27:24 -08:00
|
|
|
cp "$GRADIENCE_THEME_DIR/vapor.json" "$GRADIENCE_DIR/vapor.json"
|
2023-12-19 10:30:13 -08:00
|
|
|
fi
|
2024-01-06 00:16:39 -08:00
|
|
|
if [[ ! -f "$GRADIENCE_DIR/vgui2.json" ]]; then
|
2024-01-30 17:27:24 -08:00
|
|
|
cp "$GRADIENCE_THEME_DIR/vgui2.json" "$GRADIENCE_DIR/vgui2.json"
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROMPT_THEME_DIR="/usr/etc/skel/.local/share/org.gnome.Prompt/palettes"
|
|
|
|
PROMPT_DIR="$HOME/.local/share/org.gnome.Prompt/palettes"
|
|
|
|
mkdir -p "$PROMPT_DIR"
|
|
|
|
if [[ ! -f "$PROMPT_DIR/vapor.palette" ]]; then
|
|
|
|
cp "$PROMPT_THEME_DIR/vapor.palette" "$PROMPT_DIR/vapor.palette"
|
|
|
|
fi
|
|
|
|
if [[ ! -f "$PROMPT_DIR/vgui2.palette" ]]; then
|
|
|
|
cp "$PROMPT_THEME_DIR/vgui2.palette" "$PROMPT_DIR/vgui2.palette"
|
2023-12-19 10:30:13 -08:00
|
|
|
fi
|
|
|
|
|
2024-01-09 21:22:29 -08:00
|
|
|
# Initialize Prompt config
|
|
|
|
# This is intentionally run on both images to ensure a user rebasing from Silverblue to Kinoite
|
|
|
|
# doesn't get their Prompt config wiped out.
|
|
|
|
echo 'Configuring Prompt'
|
|
|
|
if [[ ! -f "$BAZZITE_CONFIG_DIR/prompt-initialized" ]]; then
|
|
|
|
if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
|
|
|
|
dconf load / < /etc/dconf/db/local.d/02-bazzite-kde
|
|
|
|
fi
|
|
|
|
touch "$BAZZITE_CONFIG_DIR/prompt-initialized"
|
|
|
|
fi
|
|
|
|
|
2024-01-06 16:20:21 -08:00
|
|
|
if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
|
2023-08-08 13:53:26 -07:00
|
|
|
echo 'Running setup for Kinoite'
|
|
|
|
|
2023-08-08 14:20:09 -07:00
|
|
|
echo 'Enabling System76-Scheduler KWin script'
|
2023-08-08 19:23:10 -07:00
|
|
|
kwriteconfig5 --file kwinrc --group Plugins --key kwin-system76-scheduler-integrationEnabled true
|
2023-08-08 13:53:26 -07:00
|
|
|
|
2023-12-28 16:28:17 -08:00
|
|
|
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
|
|
|
|
echo 'Running setup for Kinoite on Steam Deck'
|
|
|
|
if [[ ! -f "$HOME/Desktop/Return.desktop" ]]; then
|
2024-01-08 12:28:42 -08:00
|
|
|
echo 'Re-creating return to gamemode shortcut'
|
|
|
|
mkdir -p $HOME/Desktop/
|
|
|
|
cp "/etc/skel/Desktop/Return.desktop" "$HOME/Desktop/Return.desktop"
|
2023-12-28 16:28:17 -08:00
|
|
|
fi
|
2023-08-08 13:53:26 -07:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo 'Running setup for Silverblue'
|
|
|
|
|
2023-10-03 22:55:55 -07:00
|
|
|
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
|
2023-08-08 13:53:26 -07:00
|
|
|
echo 'Running setup for Silverblue on Steam Deck'
|
|
|
|
|
2023-09-15 00:30:41 -07:00
|
|
|
echo 'Setting up templates'
|
2024-01-06 16:20:21 -08:00
|
|
|
mkdir -p "$HOME/Templates"
|
2023-09-15 00:37:38 -07:00
|
|
|
if [[ ! -f "$HOME/Templates/vkBasalt.conf" ]]; then
|
2024-01-06 00:16:39 -08:00
|
|
|
ln -s "/etc/vkBasalt.conf" "$HOME/Templates/vkBasalt.conf"
|
2023-09-15 00:37:38 -07:00
|
|
|
fi
|
|
|
|
if [[ ! -f "$HOME/Templates/dxvk.conf" ]]; then
|
2024-01-06 00:16:39 -08:00
|
|
|
ln -s "/etc/dxvk-example.conf" "$HOME/Templates/dxvk.conf"
|
2023-09-15 00:37:38 -07:00
|
|
|
fi
|
2023-09-15 00:30:41 -07:00
|
|
|
|
2023-08-15 07:52:22 -07:00
|
|
|
echo 'Tweaking GNOME indexer'
|
2024-01-06 00:16:39 -08:00
|
|
|
if [[ ! -f "$HOME/.steam/.trackerignore" ]]; then
|
|
|
|
mkdir -p "$HOME/.steam"
|
|
|
|
touch "$HOME/.steam/.trackerignore"
|
|
|
|
fi
|
|
|
|
if [[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/Steam/.trackerignore" ]]; then
|
|
|
|
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/Steam"
|
|
|
|
touch "${XDG_DATA_HOME:-$HOME/.local/share}/Steam/.trackerignore"
|
|
|
|
fi
|
2023-08-08 13:53:26 -07:00
|
|
|
fi
|
2023-08-08 14:48:45 -07:00
|
|
|
fi
|
|
|
|
|
2024-01-06 16:20:21 -08:00
|
|
|
# Deck Build Setup
|
2024-01-06 23:54:13 -08:00
|
|
|
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
|
2024-01-06 16:20:21 -08:00
|
|
|
# HHD Setup
|
2024-01-29 16:17:30 -08:00
|
|
|
if /usr/libexec/hardware/hhd-supported-hardware; then
|
2023-12-21 00:37:35 -08:00
|
|
|
echo 'Enabling HHD'
|
2024-01-30 16:16:56 -08:00
|
|
|
pkexec /usr/libexec/bazzite-enable-hhd
|
2023-12-21 00:37:35 -08:00
|
|
|
fi
|
2024-01-06 16:20:21 -08:00
|
|
|
|
2024-01-06 23:54:13 -08:00
|
|
|
# SDGyroDSU Setup
|
2024-01-29 16:17:30 -08:00
|
|
|
if /usr/libexec/hardware/valve-hardware; then
|
2024-01-06 23:54:13 -08:00
|
|
|
systemctl --user enable --now sdgyrodsu.service
|
|
|
|
else
|
|
|
|
systemctl --user disable --now sdgyrodsu.service
|
|
|
|
fi
|
|
|
|
|
2024-01-06 16:20:21 -08:00
|
|
|
# Legion Rotation Fix
|
|
|
|
AUTOSTART_FOLDER=${XDG_CONFIG_HOME:-$HOME/.config}
|
2024-01-15 17:21:23 -08:00
|
|
|
|
|
|
|
# Remove old legion-only file
|
|
|
|
if [[ -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop" ]]; then
|
|
|
|
rm -f "$AUTOSTART_FOLDER/autostart/bazzite-handle-legion-go-rotation.desktop"
|
|
|
|
fi
|
|
|
|
|
2024-01-29 21:19:37 -08:00
|
|
|
if /usr/libexec/hardware/rotation-fix-hardware && [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
|
2024-01-15 17:21:23 -08:00
|
|
|
if [[ ! -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop" ]]; then
|
|
|
|
echo 'Adding rotation fix'
|
2024-01-06 16:20:21 -08:00
|
|
|
mkdir -p "$AUTOSTART_FOLDER/autostart"
|
2024-01-15 17:21:23 -08:00
|
|
|
printf "[Desktop Entry]\nExec=/usr/libexec/bazzite-rotation-fix\nIcon=dialog-scripts\nName=bazzite-rotation-fix\nType=Application\nX-KDE-AutostartScript=true\n" > "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop"
|
2024-01-06 16:20:21 -08:00
|
|
|
fi
|
2024-01-15 17:21:23 -08:00
|
|
|
elif [[ -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop" ]]; then
|
|
|
|
echo 'Non-supported or GNOME detected, removing rotaion fix'
|
|
|
|
rm -f "$AUTOSTART_FOLDER/autostart/bazzite-rotation-fix.desktop"
|
2024-01-06 16:20:21 -08:00
|
|
|
fi
|
2023-12-21 00:37:35 -08:00
|
|
|
fi
|
|
|
|
|
2023-08-08 14:48:45 -07:00
|
|
|
# Prevent future executions
|
|
|
|
echo "Writing state file"
|
2023-09-27 15:56:19 -07:00
|
|
|
echo $USER_SETUP_VER > $USER_SETUP_VER_FILE
|
2023-10-13 14:33:43 -07:00
|
|
|
echo $FEDORA_VERSION > $USER_SETUP_FEDORA_VER_FILE
|
2024-01-29 16:17:30 -08:00
|
|
|
echo $BASE_IMAGE_NAME > $USER_SETUP_IMAGE_VER_FILE
|