fix: Correct issue with bazzite-hardware-setup executing every launch.

fix: Modify bazzite-user-setup to match bazzite-hardware-setup in ability to re-launch as needed
This commit is contained in:
Kyle Gospodnetich 2023-09-27 15:56:19 -07:00
parent 3621027fdf
commit 403547ddb3
3 changed files with 14 additions and 4 deletions

View File

@ -8,7 +8,7 @@ BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO)
# SCRIPT VERSION
HWS_VER=2
HWS_VER_FILE="/etc/bazzite/hws_version"
HWS_VER_RAN=$(cat $HWS_VERSION_FILE)
HWS_VER_RAN=$(cat $HWS_VER_FILE)
# IMAGE IDENTIFIERS
KNOWN_IMAGE_NAME_FILE="/etc/bazzite/image_name"
@ -21,7 +21,7 @@ if [[ -f $HWS_VER_FILE && $HWS_VER = $HWS_VER_RAN ]]; then
if [[ -f $KNOWN_IMAGE_NAME_FILE && -f $KNOWN_IMAGE_FLAVOR_FILE ]]; then
# Run script if image has been rebased
if [[ $IMAGE_NAME = $KNOWN_IMAGE_NAME && $IMAGE_FLAVOR = $KNOWN_IMAGE_FLAVOR ]]; then
echo "Hardware setup has already ran. Exiting..."
echo "Hardware setup has already run. Exiting..."
exit 0
fi
fi

View File

@ -1,5 +1,16 @@
#!/usr/bin/env bash
# SCRIPT VERSION
USER_SETUP_VER=2
USER_SETUP_VER_FILE="$HOME/.bazzite-configured"
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
# Run script if updated
if [[ -f $USER_SETUP_VER_FILE && $USER_SETUP_VER = $USER_SETUP_VER_RAN ]]; then
echo "User setup has already run. Exiting..."
exit 0
fi
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)
@ -109,4 +120,4 @@ flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub
# Prevent future executions
echo "Writing state file"
touch $HOME/.bazzite-configured
echo $USER_SETUP_VER > $USER_SETUP_VER_FILE

View File

@ -1,7 +1,6 @@
[Unit]
Description=Configure Bazzite for current user
Requires=xdg-desktop-autostart.target
ConditionPathExists=!%h/.bazzite-configured
[Service]
Type=simple