mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-31 06:32:57 +00:00
121 lines
4.5 KiB
Bash
Executable File
121 lines
4.5 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
|
|
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)"
|
|
|
|
# SCRIPT VERSION
|
|
USER_SETUP_VER=19
|
|
USER_SETUP_VER_FILE="$HOME/.bazzite-configured"
|
|
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
|
|
USER_SETUP_FEDORA_VER_FILE="$HOME/.bazzite-configured-fedora-version"
|
|
USER_SETUP_FEDORA_VER_RAN=$(cat $USER_SETUP_FEDORA_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
|
|
echo "User setup has already run. Exiting..."
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Enable Flathub
|
|
if grep -qz 'fedora' <<< $(flatpak remotes); then
|
|
flatpak remote-delete --user fedora --force
|
|
fi
|
|
flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub.flatpakrepo
|
|
flatpak remote-modify --user --enable flathub
|
|
|
|
# Handle privileged tasks
|
|
pkexec /usr/libexec/bazzite-privileged-user-setup
|
|
|
|
# Set up optional Gradience themes
|
|
mkdir -p "$HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/"
|
|
if [[ ! -f "$HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vapor.json" ]]; then
|
|
rm -f $HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vapor.json
|
|
cp /usr/share/ublue-os/bazzite/themes/vapor.json $HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vapor.json
|
|
fi
|
|
if [[ ! -f "$HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vgui2.json" ]]; then
|
|
rm -f $HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vgui2.json
|
|
cp /usr/share/ublue-os/bazzite/themes/vgui2.json $HOME/.var/app/com.github.GradienceTeam.Gradience/config/presets/user/vgui2.json
|
|
fi
|
|
|
|
if [[ $BASE_IMAGE_NAME =~ "kinoite" ]]; then
|
|
echo 'Running setup for Kinoite'
|
|
|
|
echo 'Enabling System76-Scheduler KWin script'
|
|
kwriteconfig5 --file kwinrc --group Plugins --key kwin-system76-scheduler-integrationEnabled true
|
|
|
|
echo 'Creating Desktop shortcuts'
|
|
mkdir -p $HOME/Desktop/
|
|
if [[ ! -f "$HOME/Desktop/steam.desktop" ]]; then
|
|
cp /usr/share/applications/steam.desktop $HOME/Desktop/steam.desktop
|
|
fi
|
|
if [[ ! -f "$HOME/Desktop/net.lutris.Lutris.desktop" ]]; then
|
|
cp /usr/share/applications/net.lutris.Lutris.desktop $HOME/Desktop/net.lutris.Lutris.desktop
|
|
fi
|
|
|
|
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
|
|
cp /etc/skel.d/Desktop/Return.desktop $HOME/Desktop/Return.desktop
|
|
fi
|
|
fi
|
|
else
|
|
echo 'Running setup for Silverblue'
|
|
|
|
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
|
|
echo 'Running setup for Silverblue on Steam Deck'
|
|
|
|
echo 'Setting up templates'
|
|
if [[ ! -f "$HOME/Templates/vkBasalt.conf" ]]; then
|
|
ln -s /etc/vkBasalt.conf $HOME/Templates/vkBasalt.conf
|
|
fi
|
|
if [[ ! -f "$HOME/Templates/dxvk.conf" ]]; then
|
|
ln -s /etc/dxvk-example.conf $HOME/Templates/dxvk.conf
|
|
fi
|
|
|
|
echo 'Tweaking GNOME indexer'
|
|
mkdir -p $HOME/.steam
|
|
touch $HOME/.steam/.trackerignore
|
|
mkdir -p $HOME/.local/share/Steam
|
|
touch $HOME/.local/share/Steam/.trackerignore
|
|
fi
|
|
fi
|
|
|
|
# HHD Setup for Lenovo Legion Go
|
|
if [[ $IMAGE_NAME =~ "deck" ]]; then
|
|
if [[ ":83E1:" =~ ":$SYS_ID:" ]]; then
|
|
echo 'Enabling HHD'
|
|
pkexec /usr/libexec/bazzite-enable-hhd "$USER"
|
|
fi
|
|
fi
|
|
|
|
# Previous images used Bazzite-Arch to run Steam, Lutris, and Protontricks on desktop images
|
|
if [[ -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop" ]]; then
|
|
rm -f "$HOME/.local/share/applications/bazzite-arch-steam.desktop"
|
|
fi
|
|
|
|
if [[ -f "$HOME/.local/share/applications/bazzite-arch-net.lutris.Lutris.desktop" ]]; then
|
|
rm -f "$HOME/.local/share/applications/bazzite-arch-net.lutris.Lutris.desktop"
|
|
fi
|
|
|
|
if [[ -f "$HOME/.local/share/applications/bazzite-arch-protontricks.desktop" ]]; then
|
|
rm -f "$HOME/.local/share/applications/bazzite-arch-protontricks.desktop"
|
|
fi
|
|
|
|
if [[ -f "$HOME/Desktop/bazzite-arch-steam.desktop" ]]; then
|
|
rm -f "$HOME/Desktop/bazzite-arch-steam.desktop"
|
|
fi
|
|
|
|
if [[ -f "$HOME/Desktop/bazzite-arch-net.lutris.Lutris.desktop" ]]; then
|
|
rm -f "$HOME/Desktop/bazzite-arch-net.lutris.Lutris.desktop"
|
|
fi
|
|
|
|
# Prevent future executions
|
|
echo "Writing state file"
|
|
echo $USER_SETUP_VER > $USER_SETUP_VER_FILE
|
|
echo $FEDORA_VERSION > $USER_SETUP_FEDORA_VER_FILE
|