From 765fb55f0fa6c9fc02ef1b571e36e12c83ed5055 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 11:41:13 -0400 Subject: [PATCH 01/20] refactor: Move flatpak-manager and user-setup to modules dir --- config/files/{ => modules}/usr/bin/zeliblue-flatpak-manager | 0 config/files/{ => modules}/usr/bin/zeliblue-user-setup | 0 .../usr/lib/systemd/system/zeliblue-flatpak-manager.service | 0 .../usr/lib/systemd/user/zeliblue-user-setup.service | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename config/files/{ => modules}/usr/bin/zeliblue-flatpak-manager (100%) rename config/files/{ => modules}/usr/bin/zeliblue-user-setup (100%) rename config/files/{ => modules}/usr/lib/systemd/system/zeliblue-flatpak-manager.service (100%) rename config/files/{ => modules}/usr/lib/systemd/user/zeliblue-user-setup.service (100%) diff --git a/config/files/usr/bin/zeliblue-flatpak-manager b/config/files/modules/usr/bin/zeliblue-flatpak-manager similarity index 100% rename from config/files/usr/bin/zeliblue-flatpak-manager rename to config/files/modules/usr/bin/zeliblue-flatpak-manager diff --git a/config/files/usr/bin/zeliblue-user-setup b/config/files/modules/usr/bin/zeliblue-user-setup similarity index 100% rename from config/files/usr/bin/zeliblue-user-setup rename to config/files/modules/usr/bin/zeliblue-user-setup diff --git a/config/files/usr/lib/systemd/system/zeliblue-flatpak-manager.service b/config/files/modules/usr/lib/systemd/system/zeliblue-flatpak-manager.service similarity index 100% rename from config/files/usr/lib/systemd/system/zeliblue-flatpak-manager.service rename to config/files/modules/usr/lib/systemd/system/zeliblue-flatpak-manager.service diff --git a/config/files/usr/lib/systemd/user/zeliblue-user-setup.service b/config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service similarity index 100% rename from config/files/usr/lib/systemd/user/zeliblue-user-setup.service rename to config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service From 0f3c4de8cb044f5e9f7e22aac558f0cf92bbc501 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 11:42:54 -0400 Subject: [PATCH 02/20] fix: Remove just setup from user-setup --- config/files/modules/usr/bin/zeliblue-user-setup | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/files/modules/usr/bin/zeliblue-user-setup b/config/files/modules/usr/bin/zeliblue-user-setup index 62ce2131..421a15f4 100755 --- a/config/files/modules/usr/bin/zeliblue-user-setup +++ b/config/files/modules/usr/bin/zeliblue-user-setup @@ -2,11 +2,6 @@ # Adapted from uBlue's Bazzite (https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/bin/bazzite-user-setup) -# Setup justfile -if [[ -f "${HOME}/.justfile" ]]; then - echo "!include /usr/share/ublue-os/just/custom.just" >> "${HOME}/.justfile" -fi - # Setup Flathub if grep -qz 'fedora' <<< $(flatpak remotes); then flatpak remote-delete --user fedora --force From 92431a491a71be2618542964ce12d3ce696eb340 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 11:44:18 -0400 Subject: [PATCH 03/20] fix: Disable systemd module We're only enabling the Flatpak-related services, and those are being converted into a separate module. --- config/common-config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/common-config.yml b/config/common-config.yml index 882bf166..947fdd84 100644 --- a/config/common-config.yml +++ b/config/common-config.yml @@ -28,13 +28,13 @@ modules: - dconf-update-service # a service unit that updates the dconf db on boot # - devpod # https://devpod.sh/ as an rpm -- type: systemd - system: - enabled: - - zeliblue-flatpak-manager.service - user: - enabled: - - zeliblue-user-setup.service +# - type: systemd +# system: +# enabled: +# - zeliblue-flatpak-manager.service +# user: +# enabled: +# - zeliblue-user-setup.service # - type: yafti From 4238f9b85853a1e05f614bcfa2e9e3a27eba77e1 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:14:20 -0400 Subject: [PATCH 04/20] refactor: Use generic names for flatpak setup scripts and services --- ...e-flatpak-manager => system-flatpak-setup} | 26 +++++++++---------- ...zeliblue-user-setup => user-flatpak-setup} | 6 ++--- ...r.service => system-flatpak-setup.service} | 2 +- .../systemd/user/user-flatpak-setup.service | 11 ++++++++ .../systemd/user/zeliblue-user-setup.service | 11 -------- 5 files changed, 26 insertions(+), 30 deletions(-) rename config/files/modules/usr/bin/{zeliblue-flatpak-manager => system-flatpak-setup} (66%) rename config/files/modules/usr/bin/{zeliblue-user-setup => user-flatpak-setup} (57%) rename config/files/modules/usr/lib/systemd/system/{zeliblue-flatpak-manager.service => system-flatpak-setup.service} (84%) create mode 100644 config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service delete mode 100644 config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service diff --git a/config/files/modules/usr/bin/zeliblue-flatpak-manager b/config/files/modules/usr/bin/system-flatpak-setup similarity index 66% rename from config/files/modules/usr/bin/zeliblue-flatpak-manager rename to config/files/modules/usr/bin/system-flatpak-setup index 3899b3ce..8c95fb33 100755 --- a/config/files/modules/usr/bin/zeliblue-flatpak-manager +++ b/config/files/modules/usr/bin/system-flatpak-setup @@ -1,17 +1,15 @@ #!/usr/bin/env bash -# Adapted from uBlue's Bazzite (https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/bin/bazzite-flatpak-manager) +# # Script Version +# VER=3 +VER_FILE="/etc/ublue-os/system-flatpak-configured" +# VER_RAN=$(cat $VER_FILE) -# Script Version -VER=3 -VER_FILE="/etc/zeliblue/flatpak_manager_version" -VER_RAN=$(cat $VER_FILE) - -# Run script if updated -if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then - echo "Flatpak manager v$VER has already ran. Exiting..." - exit 0 -fi +# # Run script if updated +# if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then +# echo "Flatpak manager v$VER has already ran. Exiting..." +# exit 0 +# fi # Opt out of and remove Fedora's flatpak repo if grep -qz 'fedora' <<< $(flatpak remotes); then @@ -25,8 +23,8 @@ flatpak remote-add --if-not-exists --system --title="Flathub (System)" flathub-s # Lists of flatpaks FLATPAK_LIST=$(flatpak list --columns=application) -INSTALL_LIST=$(cat /usr/etc/flatpak/install) -REMOVE_LIST=$(cat /usr/etc/flatpak/remove) +INSTALL_LIST=$(cat /etc/flatpak/install) +REMOVE_LIST=$(cat /etc/flatpak/remove) # Install flatpaks in list if [[ -n $INSTALL_LIST ]]; then @@ -46,5 +44,5 @@ if [[ -n $REMOVE_LIST ]]; then done fi -mkdir -p /etc/zeliblue +mkdir -p /etc/ublue-os echo $VER > $VER_FILE \ No newline at end of file diff --git a/config/files/modules/usr/bin/zeliblue-user-setup b/config/files/modules/usr/bin/user-flatpak-setup similarity index 57% rename from config/files/modules/usr/bin/zeliblue-user-setup rename to config/files/modules/usr/bin/user-flatpak-setup index 421a15f4..a5c4809d 100755 --- a/config/files/modules/usr/bin/zeliblue-user-setup +++ b/config/files/modules/usr/bin/user-flatpak-setup @@ -1,7 +1,5 @@ #!/usr/bin/env bash -# Adapted from uBlue's Bazzite (https://github.com/ublue-os/bazzite/blob/main/system_files/desktop/shared/usr/bin/bazzite-user-setup) - # Setup Flathub if grep -qz 'fedora' <<< $(flatpak remotes); then flatpak remote-delete --user fedora --force @@ -10,5 +8,5 @@ flatpak remote-add --if-not-exists --user flathub-user https://flathub.org/repo/ # Prevent future executions echo "Writing state file" -mkdir -p $HOME/.config/zeliblue/ -touch $HOME/.config/zeliblue/zeliblue-configured \ No newline at end of file +mkdir -p $HOME/.config/ublue-os/ +touch $HOME/.config/ublue-os/user-flatpak-configured \ No newline at end of file diff --git a/config/files/modules/usr/lib/systemd/system/zeliblue-flatpak-manager.service b/config/files/modules/usr/lib/systemd/system/system-flatpak-setup.service similarity index 84% rename from config/files/modules/usr/lib/systemd/system/zeliblue-flatpak-manager.service rename to config/files/modules/usr/lib/systemd/system/system-flatpak-setup.service index d51f612d..ae71aaa0 100644 --- a/config/files/modules/usr/lib/systemd/system/zeliblue-flatpak-manager.service +++ b/config/files/modules/usr/lib/systemd/system/system-flatpak-setup.service @@ -6,7 +6,7 @@ After=network-online.target [Service] Type=oneshot -ExecStart=/usr/bin/zeliblue-flatpak-manager +ExecStart=/usr/bin/system-flatpak-setup Restart=on-failure [Install] diff --git a/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service b/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service new file mode 100644 index 00000000..bf91bee6 --- /dev/null +++ b/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service @@ -0,0 +1,11 @@ +[Unit] +Description=Configure Flatpaks for current user +Requires=xdg-desktop-autostart.target +ConditionPathExists=!%h/.config/ublue-os/user-flatpak-configured + +[Service] +Type=simple +ExecStart=/usr/bin/user-flatpak-setup + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service b/config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service deleted file mode 100644 index e7c58a92..00000000 --- a/config/files/modules/usr/lib/systemd/user/zeliblue-user-setup.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Configure Zeliblue for current user -Requires=xdg-desktop-autostart.target -ConditionPathExists=!%h/.config/zeliblue/zeliblue-configured - -[Service] -Type=simple -ExecStart=/usr/bin/zeliblue-user-setup - -[Install] -WantedBy=default.target \ No newline at end of file From 50f4a4b6462e2cf1c0477721359ac6bd3fc59b48 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:22:29 -0400 Subject: [PATCH 05/20] refactor: Standardize config file checks in flatpak-setup scripts --- .../files/modules/usr/bin/system-flatpak-setup | 18 ++++++++++-------- .../files/modules/usr/bin/user-flatpak-setup | 13 ++++++++++++- .../systemd/user/user-flatpak-setup.service | 1 - 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/config/files/modules/usr/bin/system-flatpak-setup b/config/files/modules/usr/bin/system-flatpak-setup index 8c95fb33..941a21b2 100755 --- a/config/files/modules/usr/bin/system-flatpak-setup +++ b/config/files/modules/usr/bin/system-flatpak-setup @@ -1,15 +1,15 @@ #!/usr/bin/env bash -# # Script Version -# VER=3 +# Script Version +VER=1 VER_FILE="/etc/ublue-os/system-flatpak-configured" -# VER_RAN=$(cat $VER_FILE) +VER_RAN=$(cat $VER_FILE) -# # Run script if updated -# if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then -# echo "Flatpak manager v$VER has already ran. Exiting..." -# exit 0 -# fi +# Run script if updated +if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then + echo "Flatpak setup v$VER has already ran. Exiting..." + exit 0 +fi # Opt out of and remove Fedora's flatpak repo if grep -qz 'fedora' <<< $(flatpak remotes); then @@ -44,5 +44,7 @@ if [[ -n $REMOVE_LIST ]]; then done fi +# Prevent future executions +echo "Writing state file" mkdir -p /etc/ublue-os echo $VER > $VER_FILE \ No newline at end of file diff --git a/config/files/modules/usr/bin/user-flatpak-setup b/config/files/modules/usr/bin/user-flatpak-setup index a5c4809d..9e2d2ab0 100755 --- a/config/files/modules/usr/bin/user-flatpak-setup +++ b/config/files/modules/usr/bin/user-flatpak-setup @@ -1,5 +1,16 @@ #!/usr/bin/env bash +# Script Version +VER=1 +VER_FILE="$HOME/.config/ublue-os/user-flatpak-configured" +VER_RAN=$(cat $VER_FILE) + +# Run script if updated +if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then + echo "Flatpak setup v$VER has already ran. Exiting..." + exit 0 +fi + # Setup Flathub if grep -qz 'fedora' <<< $(flatpak remotes); then flatpak remote-delete --user fedora --force @@ -9,4 +20,4 @@ flatpak remote-add --if-not-exists --user flathub-user https://flathub.org/repo/ # Prevent future executions echo "Writing state file" mkdir -p $HOME/.config/ublue-os/ -touch $HOME/.config/ublue-os/user-flatpak-configured \ No newline at end of file +echo $VER > $VER_FILE \ No newline at end of file diff --git a/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service b/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service index bf91bee6..89a3fdc1 100644 --- a/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service +++ b/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service @@ -1,7 +1,6 @@ [Unit] Description=Configure Flatpaks for current user Requires=xdg-desktop-autostart.target -ConditionPathExists=!%h/.config/ublue-os/user-flatpak-configured [Service] Type=simple From a3d50d37ab94c63a6d1a551d1a3d37d35dee158f Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:37:45 -0400 Subject: [PATCH 06/20] feat: Initial add flatpaks module --- modules/flatpaks/flatpaks.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 modules/flatpaks/flatpaks.sh diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh new file mode 100644 index 00000000..3129beda --- /dev/null +++ b/modules/flatpaks/flatpaks.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Tell build process to exit if there are any errors. +set -oue pipefail + +cp -r "$CONFIG_DIRECTORY/modules/usr/bin/{system,user}-flatpak-setup" "/usr/bin/{system,user}-flatpak-setup" +cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" +cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" + From b8766e4d101f02e7455c6762022290c2201192e5 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:43:23 -0400 Subject: [PATCH 07/20] feat: Enable flatpaks module --- config/gnome-packages.yml | 18 +++++++++++------- modules/flatpaks/flatpaks.sh | 4 ++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/config/gnome-packages.yml b/config/gnome-packages.yml index bb0f479e..80280003 100644 --- a/config/gnome-packages.yml +++ b/config/gnome-packages.yml @@ -1,7 +1,11 @@ -type: rpm-ostree -install: - - gnome-console -remove: - - gnome-classic-session - - gnome-terminal - - gnome-terminal-nautilus \ No newline at end of file +modules: + +- type: rpm-ostree + install: + - gnome-console + remove: + - gnome-classic-session + - gnome-terminal + - gnome-terminal-nautilus + +- type: flatpaks \ No newline at end of file diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index 3129beda..a5cb34fc 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -3,7 +3,11 @@ # Tell build process to exit if there are any errors. set -oue pipefail +echo "Installing and enabling flatpaks module" cp -r "$CONFIG_DIRECTORY/modules/usr/bin/{system,user}-flatpak-setup" "/usr/bin/{system,user}-flatpak-setup" cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" +systemctl enable system-flatpak-setup.service +systemctl enable --global user-flatpak-setup.service + From b688cb95406711164ea9c396ba032244cb30a07b Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:46:50 -0400 Subject: [PATCH 08/20] fix: Copy system and user scripts separately --- modules/flatpaks/flatpaks.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index a5cb34fc..f96d2e63 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -4,7 +4,8 @@ set -oue pipefail echo "Installing and enabling flatpaks module" -cp -r "$CONFIG_DIRECTORY/modules/usr/bin/{system,user}-flatpak-setup" "/usr/bin/{system,user}-flatpak-setup" +cp -r "$CONFIG_DIRECTORY/modules/usr/bin/system-flatpak-setup" "/usr/bin/system-flatpak-setup" +cp -r "$CONFIG_DIRECTORY/modules/usr/bin/user-flatpak-setup" "/usr/bin/user-flatpak-setup" cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" From b54fd991db4d5fff09470042469f66b0da5e4be3 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:50:24 -0400 Subject: [PATCH 09/20] fix: Point to correct directory --- modules/flatpaks/flatpaks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index f96d2e63..40780f5d 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -4,10 +4,10 @@ set -oue pipefail echo "Installing and enabling flatpaks module" -cp -r "$CONFIG_DIRECTORY/modules/usr/bin/system-flatpak-setup" "/usr/bin/system-flatpak-setup" -cp -r "$CONFIG_DIRECTORY/modules/usr/bin/user-flatpak-setup" "/usr/bin/user-flatpak-setup" -cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" -cp -r "$CONFIG_DIRECTORY/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" +cp -r "$CONFIG_DIRECTORY/files/modules/usr/bin/system-flatpak-setup" "/usr/bin/system-flatpak-setup" +cp -r "$CONFIG_DIRECTORY/files/modules/usr/bin/user-flatpak-setup" "/usr/bin/user-flatpak-setup" +cp -r "$CONFIG_DIRECTORY/files/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" +cp -r "$CONFIG_DIRECTORY/files/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" systemctl enable system-flatpak-setup.service systemctl enable --global user-flatpak-setup.service From 33e693e178510d1d218ebe8f0972627b2c4e5d2f Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 12:58:19 -0400 Subject: [PATCH 10/20] refactor: Move flatpak-setup files back into main usr dirs Unless this is made a bling module instead, this module is gonna have to work like yafti in that the necessary files need to be included in startingpoint directly. --- config/files/{modules => }/usr/bin/system-flatpak-setup | 0 config/files/{modules => }/usr/bin/user-flatpak-setup | 0 .../usr/lib/systemd/system/system-flatpak-setup.service | 0 .../usr/lib/systemd/user/user-flatpak-setup.service | 0 modules/flatpaks/flatpaks.sh | 8 +------- 5 files changed, 1 insertion(+), 7 deletions(-) rename config/files/{modules => }/usr/bin/system-flatpak-setup (100%) rename config/files/{modules => }/usr/bin/user-flatpak-setup (100%) rename config/files/{modules => }/usr/lib/systemd/system/system-flatpak-setup.service (100%) rename config/files/{modules => }/usr/lib/systemd/user/user-flatpak-setup.service (100%) diff --git a/config/files/modules/usr/bin/system-flatpak-setup b/config/files/usr/bin/system-flatpak-setup similarity index 100% rename from config/files/modules/usr/bin/system-flatpak-setup rename to config/files/usr/bin/system-flatpak-setup diff --git a/config/files/modules/usr/bin/user-flatpak-setup b/config/files/usr/bin/user-flatpak-setup similarity index 100% rename from config/files/modules/usr/bin/user-flatpak-setup rename to config/files/usr/bin/user-flatpak-setup diff --git a/config/files/modules/usr/lib/systemd/system/system-flatpak-setup.service b/config/files/usr/lib/systemd/system/system-flatpak-setup.service similarity index 100% rename from config/files/modules/usr/lib/systemd/system/system-flatpak-setup.service rename to config/files/usr/lib/systemd/system/system-flatpak-setup.service diff --git a/config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service b/config/files/usr/lib/systemd/user/user-flatpak-setup.service similarity index 100% rename from config/files/modules/usr/lib/systemd/user/user-flatpak-setup.service rename to config/files/usr/lib/systemd/user/user-flatpak-setup.service diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index 40780f5d..ec7a86fb 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -3,12 +3,6 @@ # Tell build process to exit if there are any errors. set -oue pipefail -echo "Installing and enabling flatpaks module" -cp -r "$CONFIG_DIRECTORY/files/modules/usr/bin/system-flatpak-setup" "/usr/bin/system-flatpak-setup" -cp -r "$CONFIG_DIRECTORY/files/modules/usr/bin/user-flatpak-setup" "/usr/bin/user-flatpak-setup" -cp -r "$CONFIG_DIRECTORY/files/modules/usr/lib/systemd/system/system-flatpak-setup.service" "/usr/lib/systemd/system/system-flatpak-setup.service" -cp -r "$CONFIG_DIRECTORY/files/modules/usr/lib/systemd/user/user-flatpak-setup.service" "/usr/lib/systemd/user/user-flatpak-setup.service" - +echo "Enabling flatpaks module" systemctl enable system-flatpak-setup.service systemctl enable --global user-flatpak-setup.service - From ed5dfe8b99fd6c83bc3e6dac6a42fde3ca8d1eae Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 13:24:08 -0400 Subject: [PATCH 11/20] feat: Create flatpak install and remove lists --- modules/flatpaks/flatpaks.sh | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index ec7a86fb..7a842321 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -3,6 +3,45 @@ # Tell build process to exit if there are any errors. set -oue pipefail +SYS_INSTALL_LIST=/usr/etc/flatpak/system-install +SYS_REMOVE_LIST=/usr/etc/flatpak/system-remove +USER_INSTALL_LIST=/usr/etc/flatpak/user-install +USER_REMOVE_LIST=/usr/etc/flatpak/user-remove + echo "Enabling flatpaks module" systemctl enable system-flatpak-setup.service systemctl enable --global user-flatpak-setup.service +mkdir -p /usr/etc/flatpak + +get_yaml_array SYSTEM_INSTALL '.system.install[]' "$1" +get_yaml_array SYSTEM_REMOVE '.system.remove[]' "$1" +get_yaml_array USER_INSTALL '.user.install[]' "$1" +get_yaml_array USER_REMOVE '.user.remove[]' "$1" + +if [[ ${#SYSTEM_INSTALL[0]} -gt 0 ]]; then + rm -f $SYS_INSTALL_LIST && touch $SYS_INSTALL_LIST + for flatpak in "${#SYSTEM_INSTALL[0]}"; do + echo $flatpak >> $SYS_INSTALL_LIST + done +fi + +if [[ ${#SYSTEM_REMOVE[0]} -gt 0 ]]; then + rm -f $SYS_REMOVE_LIST && touch $SYS_REMOVE_LIST + for flatpak in "${#SYSTEM_REMOVE[0]}"; do + echo $flatpak >> $SYS_REMOVE_LIST + done +fi + +if [[ ${#USER_INSTALL[0]} -gt 0 ]]; then + rm -f $USER_INSTALL_LIST && touch $USER_INSTALL_LIST + for flatpak in "${#USER_INSTALL[0]}"; do + echo $flatpak >> $USER_INSTALL_LIST + done +fi + +if [[ ${#USER_REMOVE[0]} -gt 0 ]]; then + rm -f $USER_REMOVE_LIST && touch $USER_REMOVE_LIST + for flatpak in "${#USER_REMOVE[0]}"; do + echo $flatpak >> $USER_REMOVE_LIST + done +fi From 178f727609e2dfeecde112a21bf17edeab5c4107 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 13:25:41 -0400 Subject: [PATCH 12/20] fix: Point system-flatpak-setup to new install and remove files --- config/files/usr/bin/system-flatpak-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/files/usr/bin/system-flatpak-setup b/config/files/usr/bin/system-flatpak-setup index 941a21b2..f4f96d91 100755 --- a/config/files/usr/bin/system-flatpak-setup +++ b/config/files/usr/bin/system-flatpak-setup @@ -23,8 +23,8 @@ flatpak remote-add --if-not-exists --system --title="Flathub (System)" flathub-s # Lists of flatpaks FLATPAK_LIST=$(flatpak list --columns=application) -INSTALL_LIST=$(cat /etc/flatpak/install) -REMOVE_LIST=$(cat /etc/flatpak/remove) +INSTALL_LIST=$(cat /etc/flatpak/system-install) +REMOVE_LIST=$(cat /etc/flatpak/system-remove) # Install flatpaks in list if [[ -n $INSTALL_LIST ]]; then From 631e3351763e6269649fdd7b24c1b97f3c95c8ad Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 13:26:41 -0400 Subject: [PATCH 13/20] feat: Enable flatpak installation and removal for user --- config/files/usr/bin/user-flatpak-setup | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config/files/usr/bin/user-flatpak-setup b/config/files/usr/bin/user-flatpak-setup index 9e2d2ab0..affb5bd9 100755 --- a/config/files/usr/bin/user-flatpak-setup +++ b/config/files/usr/bin/user-flatpak-setup @@ -17,6 +17,29 @@ if grep -qz 'fedora' <<< $(flatpak remotes); then fi flatpak remote-add --if-not-exists --user flathub-user https://flathub.org/repo/flathub.flatpakrepo +# Lists of flatpaks +FLATPAK_LIST=$(flatpak list --columns=application) +INSTALL_LIST=$(cat /etc/flatpak/user-install) +REMOVE_LIST=$(cat /etc/flatpak/user-remove) + +# Install flatpaks in list +if [[ -n $INSTALL_LIST ]]; then + for flatpak in $INSTALL_LIST; do + if grep -qvz $flatpak <<< $FLATPAK_LIST; then + flatpak install --user --noninteractive flathub-user $flatpak + fi + done +fi + +# Remove flatpaks in list +if [[ -n $REMOVE_LIST ]]; then + for flatpak in $REMOVE_LIST; do + if grep -qz $flatpak <<< $FLATPAK_LIST; then + flatpak remove --user --noninteractive $flatpak + fi + done +fi + # Prevent future executions echo "Writing state file" mkdir -p $HOME/.config/ublue-os/ From 8ddfb3a62f3f9ddd9bf5a6db4fcb518c8a2343b4 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 13:50:04 -0400 Subject: [PATCH 14/20] refactor: Move flatpak installation to flatpaks module --- config/files/usr/etc/flatpak/install | 19 ------------------- config/files/usr/etc/flatpak/remove | 5 ----- config/gnome-packages.yml | 28 +++++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 config/files/usr/etc/flatpak/install delete mode 100644 config/files/usr/etc/flatpak/remove diff --git a/config/files/usr/etc/flatpak/install b/config/files/usr/etc/flatpak/install deleted file mode 100644 index 3b50fe5d..00000000 --- a/config/files/usr/etc/flatpak/install +++ /dev/null @@ -1,19 +0,0 @@ -org.gnome.Calculator -org.gnome.Calendar -io.github.celluloid_player.Celluloid -org.gnome.Characters -org.gnome.clocks -org.gnome.Contacts -org.gnome.baobab -org.gnome.SimpleScan -org.gnome.Evince -org.gnome.font-viewer -org.gnome.Logs -org.gnome.Loupe -org.gnome.Maps -org.gnome.NautilusPreviewer -org.gnome.TextEditor -org.gnome.Weather -org.gnome.Epiphany -com.github.tchx84.Flatseal -org.gnome.World.PikaBackup \ No newline at end of file diff --git a/config/files/usr/etc/flatpak/remove b/config/files/usr/etc/flatpak/remove deleted file mode 100644 index 647b51db..00000000 --- a/config/files/usr/etc/flatpak/remove +++ /dev/null @@ -1,5 +0,0 @@ -org.fedoraproject.MediaWriter -org.gnome.Cheese -org.gnome.Connections -org.gnome.eog -org.gnome.Totem \ No newline at end of file diff --git a/config/gnome-packages.yml b/config/gnome-packages.yml index 80280003..5d3f4aeb 100644 --- a/config/gnome-packages.yml +++ b/config/gnome-packages.yml @@ -8,4 +8,30 @@ modules: - gnome-terminal - gnome-terminal-nautilus -- type: flatpaks \ No newline at end of file +- type: flatpaks + system: + install: + - org.gnome.Calculator + - org.gnome.Calendar + - io.github.celluloid_player.Celluloid + - org.gnome.Characters + - org.gnome.clocks + - org.gnome.Contacts + - org.gnome.baobab + - org.gnome.SimpleScan + - org.gnome.Evince + - org.gnome.font-viewer + - org.gnome.Logs + - org.gnome.Loupe + - org.gnome.Maps + - org.gnome.NautilusPreviewer + - org.gnome.TextEditor + - org.gnome.Weather + - org.gnome.Epiphany + - com.github.tchx84.Flatseal + - org.gnome.World.PikaBackup + user: + install: + - org.mozilla.firefox + - re.sonny.Junction + - org.libreoffice.LibreOffice From 96574c99b42e19fd10b4d6695248ed60426e6a94 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:06:37 -0400 Subject: [PATCH 15/20] fix: Build install and removal lists correctly --- modules/flatpaks/flatpaks.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index 7a842321..97d835dd 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -18,30 +18,38 @@ get_yaml_array SYSTEM_REMOVE '.system.remove[]' "$1" get_yaml_array USER_INSTALL '.user.install[]' "$1" get_yaml_array USER_REMOVE '.user.remove[]' "$1" -if [[ ${#SYSTEM_INSTALL[0]} -gt 0 ]]; then +echo "Creating system Flatpak install list" +if [[ ${#SYSTEM_INSTALL[@]} -gt 0 ]]; then rm -f $SYS_INSTALL_LIST && touch $SYS_INSTALL_LIST - for flatpak in "${#SYSTEM_INSTALL[0]}"; do + for flatpak in "${SYSTEM_INSTALL[@]}"; do + echo $flatpak echo $flatpak >> $SYS_INSTALL_LIST done fi -if [[ ${#SYSTEM_REMOVE[0]} -gt 0 ]]; then +echo "Creating system Flatpak removals list" +if [[ ${#SYSTEM_REMOVE[@]} -gt 0 ]]; then rm -f $SYS_REMOVE_LIST && touch $SYS_REMOVE_LIST - for flatpak in "${#SYSTEM_REMOVE[0]}"; do + for flatpak in "${SYSTEM_REMOVE[@]}"; do + echo $flatpak echo $flatpak >> $SYS_REMOVE_LIST done fi -if [[ ${#USER_INSTALL[0]} -gt 0 ]]; then +echo "Creating user Flatpak install list" +if [[ ${#USER_INSTALL[@]} -gt 0 ]]; then rm -f $USER_INSTALL_LIST && touch $USER_INSTALL_LIST - for flatpak in "${#USER_INSTALL[0]}"; do + for flatpak in "${USER_INSTALL[@]}"; do + echo $flatpak echo $flatpak >> $USER_INSTALL_LIST done fi -if [[ ${#USER_REMOVE[0]} -gt 0 ]]; then +echo "Creating user Flatpak removals list" +if [[ ${#USER_REMOVE[@]} -gt 0 ]]; then rm -f $USER_REMOVE_LIST && touch $USER_REMOVE_LIST - for flatpak in "${#USER_REMOVE[0]}"; do + for flatpak in "${USER_REMOVE[@]}"; do + echo $flatpak echo $flatpak >> $USER_REMOVE_LIST done fi From 75a5b8736dd88bb60e08b87e3dcff9eb7b696c34 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:11:24 -0400 Subject: [PATCH 16/20] fix(main): Remove user flatpak installs Had them there for testing, don't need them to stay. --- config/gnome-packages.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/gnome-packages.yml b/config/gnome-packages.yml index 5d3f4aeb..42548587 100644 --- a/config/gnome-packages.yml +++ b/config/gnome-packages.yml @@ -30,8 +30,3 @@ modules: - org.gnome.Epiphany - com.github.tchx84.Flatseal - org.gnome.World.PikaBackup - user: - install: - - org.mozilla.firefox - - re.sonny.Junction - - org.libreoffice.LibreOffice From 609b189ca445f9bf4b9c84e1cb203e60b8557658 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:21:12 -0400 Subject: [PATCH 17/20] chore: Add output for added flatpaks --- modules/flatpaks/flatpaks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/flatpaks/flatpaks.sh b/modules/flatpaks/flatpaks.sh index 97d835dd..8b8d1479 100644 --- a/modules/flatpaks/flatpaks.sh +++ b/modules/flatpaks/flatpaks.sh @@ -22,7 +22,7 @@ echo "Creating system Flatpak install list" if [[ ${#SYSTEM_INSTALL[@]} -gt 0 ]]; then rm -f $SYS_INSTALL_LIST && touch $SYS_INSTALL_LIST for flatpak in "${SYSTEM_INSTALL[@]}"; do - echo $flatpak + echo "Adding to system flatpak installs: $(printf ${flatpak})" echo $flatpak >> $SYS_INSTALL_LIST done fi @@ -31,7 +31,7 @@ echo "Creating system Flatpak removals list" if [[ ${#SYSTEM_REMOVE[@]} -gt 0 ]]; then rm -f $SYS_REMOVE_LIST && touch $SYS_REMOVE_LIST for flatpak in "${SYSTEM_REMOVE[@]}"; do - echo $flatpak + echo "Adding to system flatpak removals: $(printf ${flatpak})" echo $flatpak >> $SYS_REMOVE_LIST done fi @@ -40,7 +40,7 @@ echo "Creating user Flatpak install list" if [[ ${#USER_INSTALL[@]} -gt 0 ]]; then rm -f $USER_INSTALL_LIST && touch $USER_INSTALL_LIST for flatpak in "${USER_INSTALL[@]}"; do - echo $flatpak + echo "Adding to user flatpak installs: $(printf ${flatpak})" echo $flatpak >> $USER_INSTALL_LIST done fi @@ -49,7 +49,7 @@ echo "Creating user Flatpak removals list" if [[ ${#USER_REMOVE[@]} -gt 0 ]]; then rm -f $USER_REMOVE_LIST && touch $USER_REMOVE_LIST for flatpak in "${USER_REMOVE[@]}"; do - echo $flatpak + echo "Adding to user flatpak removals: $(printf ${flatpak})" echo $flatpak >> $USER_REMOVE_LIST done fi From f0a66b225805765be2b758a59cbb450ab6d69204 Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:23:27 -0400 Subject: [PATCH 18/20] style: Make flathub remote name generic System-wide was flathub-system, per-user was flathub-user. I do like having it explicit like that myself, but for more general-purpose usage, it's probably best to keep it generic as just flathub for both. Flatpak does allow specifying --system or --user already, anyway. --- config/files/usr/bin/system-flatpak-setup | 4 ++-- config/files/usr/bin/user-flatpak-setup | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/files/usr/bin/system-flatpak-setup b/config/files/usr/bin/system-flatpak-setup index f4f96d91..51dd4492 100755 --- a/config/files/usr/bin/system-flatpak-setup +++ b/config/files/usr/bin/system-flatpak-setup @@ -19,7 +19,7 @@ if grep -qz 'fedora' <<< $(flatpak remotes); then fi # Set up system Flathub -flatpak remote-add --if-not-exists --system --title="Flathub (System)" flathub-system https://flathub.org/repo/flathub.flatpakrepo +flatpak remote-add --if-not-exists --system --title="Flathub (System)" flathub https://flathub.org/repo/flathub.flatpakrepo # Lists of flatpaks FLATPAK_LIST=$(flatpak list --columns=application) @@ -30,7 +30,7 @@ REMOVE_LIST=$(cat /etc/flatpak/system-remove) if [[ -n $INSTALL_LIST ]]; then for flatpak in $INSTALL_LIST; do if grep -qvz $flatpak <<< $FLATPAK_LIST; then - flatpak install --system --noninteractive flathub-system $flatpak + flatpak install --system --noninteractive flathub $flatpak fi done fi diff --git a/config/files/usr/bin/user-flatpak-setup b/config/files/usr/bin/user-flatpak-setup index affb5bd9..e068f678 100755 --- a/config/files/usr/bin/user-flatpak-setup +++ b/config/files/usr/bin/user-flatpak-setup @@ -15,7 +15,7 @@ fi if grep -qz 'fedora' <<< $(flatpak remotes); then flatpak remote-delete --user fedora --force fi -flatpak remote-add --if-not-exists --user flathub-user https://flathub.org/repo/flathub.flatpakrepo +flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo # Lists of flatpaks FLATPAK_LIST=$(flatpak list --columns=application) @@ -26,7 +26,7 @@ REMOVE_LIST=$(cat /etc/flatpak/user-remove) if [[ -n $INSTALL_LIST ]]; then for flatpak in $INSTALL_LIST; do if grep -qvz $flatpak <<< $FLATPAK_LIST; then - flatpak install --user --noninteractive flathub-user $flatpak + flatpak install --user --noninteractive flathub $flatpak fi done fi From 8e69616695ba97888a1ae2f24b835327a174012e Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:27:38 -0400 Subject: [PATCH 19/20] refactor: Use flatpaks module for kinoite --- config/files/kinoite/etc/flatpak/install | 14 ------- config/plasma-packages.yml | 48 +++++++++++++++++------- 2 files changed, 34 insertions(+), 28 deletions(-) delete mode 100644 config/files/kinoite/etc/flatpak/install diff --git a/config/files/kinoite/etc/flatpak/install b/config/files/kinoite/etc/flatpak/install deleted file mode 100644 index 13ad353d..00000000 --- a/config/files/kinoite/etc/flatpak/install +++ /dev/null @@ -1,14 +0,0 @@ -org.kde.ark -org.kde.filelight -org.kde.gwenview -org.kde.haruna -org.kde.kalk -org.kde.kclock -org.kde.kfind -org.kde.kweather -org.kde.kwrite -org.kde.okular -org.mozilla.firefox -com.borgbase.Vorta -com.github.tchx84.Flatseal -org.gnome.Logs \ No newline at end of file diff --git a/config/plasma-packages.yml b/config/plasma-packages.yml index 604c9ffd..9e86f474 100644 --- a/config/plasma-packages.yml +++ b/config/plasma-packages.yml @@ -1,14 +1,34 @@ -type: rpm-ostree -# install: -# - ksystemlog -remove: - - ark - - ark-libs - - filelight - - gwenview - - gwenview-libs - - kate - - kate-plugins - - kcalc - - kfind - - okular +modules: + +- type: rpm-ostree + # install: + # - ksystemlog + remove: + - ark + - ark-libs + - filelight + - gwenview + - gwenview-libs + - kate + - kate-plugins + - kcalc + - kfind + - okular + +- type: flatpaks + system: + install: + - org.kde.ark + - org.kde.filelight + - org.kde.gwenview + - org.kde.haruna + - org.kde.kalk + - org.kde.kclock + - org.kde.kfind + - org.kde.kweather + - org.kde.kwrite + - org.kde.okular + - org.mozilla.firefox + - com.borgbase.Vorta + - com.github.tchx84.Flatseal + - org.gnome.Logs From 82265f4d9892cb0f5b14514b5d2b025ad1140a4d Mon Sep 17 00:00:00 2001 From: zelikos Date: Sun, 1 Oct 2023 15:29:57 -0400 Subject: [PATCH 20/20] fix(dconf): packaging-format-preference: flathub-user -> flathub Since I'm switching back to using "flathub" as the remote name instead of specifying -user vs -system --- config/files/usr/etc/dconf/db/local.d/01-zeliblue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/files/usr/etc/dconf/db/local.d/01-zeliblue b/config/files/usr/etc/dconf/db/local.d/01-zeliblue index 85ce9629..3630fa2b 100644 --- a/config/files/usr/etc/dconf/db/local.d/01-zeliblue +++ b/config/files/usr/etc/dconf/db/local.d/01-zeliblue @@ -43,7 +43,7 @@ name="Launch Console" custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/'] [org/gnome/software] -packaging-format-preference=['flatpak:flathub-user'] +packaging-format-preference=['flatpak:flathub'] download-updates=false download-updates-notify=false