From 97fab178c6f214804f2b8b5e044e03ac2416feb0 Mon Sep 17 00:00:00 2001 From: Tulili Date: Fri, 25 Aug 2023 14:32:08 -0300 Subject: [PATCH 1/3] fix: make sure flatpak install script does not run if already installed --- .../desktop/shared/usr/bin/ublue-flatpak-system-install | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install index f27b053afe..c0c6ddf209 100755 --- a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install +++ b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install @@ -1,6 +1,13 @@ #!/usr/bin/env bash source /etc/default/bazzite +FLATPAK_INSTALLED_CONDITION_CHECK="/etc/bazzite/sys_flatpak_configured" + +if [[ -f "$FLATPAK_INSTALLED_CONDITION_CHECK" ]] ; then + printf "System flatpaks are already installed (%s)" "$FLATPAK_INSTALLED_CONDITION_CHECK" + exit 0 +fi + if grep -qz 'fedora' <<< $(flatpak remotes); then /usr/lib/fedora-third-party/fedora-third-party-opt-out /usr/bin/fedora-third-party disable @@ -29,3 +36,5 @@ if [[ -f '/etc/flatpak/deck' ]]; then fi rm -rf /etc/flatpak/{deck,flathub,objects} +mkdir /etc/bazzite +touch "$FLATPAK_INSTALLED_CONDITION_CHECK" From d6667e85bf99348b67c1960ea3c30eab4775f31b Mon Sep 17 00:00:00 2001 From: tulili Date: Sat, 26 Aug 2023 23:59:30 -0300 Subject: [PATCH 2/3] feat: reduce boot times by creating donefiles w scripts in desktop version --- .../desktop/shared/usr/bin/bazzite-hardware-setup | 12 ++++++++++-- .../shared/usr/bin/ublue-flatpak-system-install | 10 +++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index 903c92155f..f1530a1dfe 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -1,6 +1,12 @@ #!/usr/bin/env bash source /etc/default/bazzite +DONEFILE=/etc/bazzite/hardware_setup_done +if [[ -e "$DONEFILE" ]] ; then + printf "Hardware was already properly set up. To run this script again, delete %s\n" "$DONEFILE" + exit 0 +fi + # GLOBAL SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" KARGS=$(rpm-ostree kargs) @@ -75,9 +81,11 @@ if [[ ! $KARGS =~ "rd.luks.options" ]]; then NEEDED_KARGS="$NEEDED_KARGS --append=rd.luks.options=discard" fi -if [[ ! -z "$NEEDED_KARGS" ]]; then +if [[ -n "$NEEDED_KARGS" ]]; then echo "Found needed karg changes, applying the following: $NEEDED_KARGS" - rpm-ostree kargs ${NEEDED_KARGS} --reboot + rpm-ostree kargs ${NEEDED_KARGS} --reboot || exit 1 + mkdir -p "$(dirname "$DONEFILE")" + touch "$DONEFILE" else echo "No karg changes needed" fi diff --git a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install index c0c6ddf209..6c010193bb 100755 --- a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install +++ b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install @@ -1,10 +1,10 @@ #!/usr/bin/env bash source /etc/default/bazzite -FLATPAK_INSTALLED_CONDITION_CHECK="/etc/bazzite/sys_flatpak_configured" +DONEFILE="/etc/bazzite/sys_flatpak_done" -if [[ -f "$FLATPAK_INSTALLED_CONDITION_CHECK" ]] ; then - printf "System flatpaks are already installed (%s)" "$FLATPAK_INSTALLED_CONDITION_CHECK" +if [[ -f "$DONEFILE" ]] ; then + printf "System flatpaks were already installed. To run this script again, delete %s\n" "$DONEFILE" exit 0 fi @@ -36,5 +36,5 @@ if [[ -f '/etc/flatpak/deck' ]]; then fi rm -rf /etc/flatpak/{deck,flathub,objects} -mkdir /etc/bazzite -touch "$FLATPAK_INSTALLED_CONDITION_CHECK" +mkdir -p "$(dirname "$DONEFILE")" +touch "$DONEFILE" From 9452a41b313f3dee01852be8d6211f7ee8c019e5 Mon Sep 17 00:00:00 2001 From: tulili Date: Sun, 27 Aug 2023 23:04:51 -0300 Subject: [PATCH 3/3] fix: check donefiles in system services + do not check flatpak donefile --- .../desktop/shared/usr/bin/bazzite-hardware-setup | 4 ---- .../desktop/shared/usr/bin/ublue-flatpak-system-install | 9 --------- .../lib/systemd/system/bazzite-hardware-setup.service | 1 + 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup index f1530a1dfe..0ca68e5739 100755 --- a/system_files/desktop/shared/usr/bin/bazzite-hardware-setup +++ b/system_files/desktop/shared/usr/bin/bazzite-hardware-setup @@ -2,10 +2,6 @@ source /etc/default/bazzite DONEFILE=/etc/bazzite/hardware_setup_done -if [[ -e "$DONEFILE" ]] ; then - printf "Hardware was already properly set up. To run this script again, delete %s\n" "$DONEFILE" - exit 0 -fi # GLOBAL SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)" diff --git a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install index 6c010193bb..f27b053afe 100755 --- a/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install +++ b/system_files/desktop/shared/usr/bin/ublue-flatpak-system-install @@ -1,13 +1,6 @@ #!/usr/bin/env bash source /etc/default/bazzite -DONEFILE="/etc/bazzite/sys_flatpak_done" - -if [[ -f "$DONEFILE" ]] ; then - printf "System flatpaks were already installed. To run this script again, delete %s\n" "$DONEFILE" - exit 0 -fi - if grep -qz 'fedora' <<< $(flatpak remotes); then /usr/lib/fedora-third-party/fedora-third-party-opt-out /usr/bin/fedora-third-party disable @@ -36,5 +29,3 @@ if [[ -f '/etc/flatpak/deck' ]]; then fi rm -rf /etc/flatpak/{deck,flathub,objects} -mkdir -p "$(dirname "$DONEFILE")" -touch "$DONEFILE" diff --git a/system_files/desktop/shared/usr/lib/systemd/system/bazzite-hardware-setup.service b/system_files/desktop/shared/usr/lib/systemd/system/bazzite-hardware-setup.service index ede1dd7b9c..5a52479ed5 100644 --- a/system_files/desktop/shared/usr/lib/systemd/system/bazzite-hardware-setup.service +++ b/system_files/desktop/shared/usr/lib/systemd/system/bazzite-hardware-setup.service @@ -7,6 +7,7 @@ Before=systemd-user-sessions.service jupiter-biosupdate.service jupiter-controll Type=oneshot RemainAfterExit=yes ExecStart=/usr/bin/bazzite-hardware-setup +ConditionPathExists=!/etc/bazzite/hardware_setup_done [Install] WantedBy=multi-user.target