From 0b669f5bb502c5e334474c54c95fbb7fed184b36 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:00:58 +0300 Subject: [PATCH 1/9] feat: switch to yafti for first boot based on what's done in bluefin & https://github.com/ublue-os/yafti#running-from-a-containerfile --- Containerfile | 1 - build.sh | 5 ++++- etc/profile.d/ublue-firstboot.sh | 4 ++-- etc/skel.d/.config/autostart/ublue-firstboot.desktop | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Containerfile b/Containerfile index 0769943..e40ea7c 100644 --- a/Containerfile +++ b/Containerfile @@ -7,7 +7,6 @@ FROM ghcr.io/ublue-os/silverblue-main:${FEDORA_MAJOR_VERSION} COPY etc /etc # COPY usr /usr -COPY ublue-firstboot /usr/bin COPY recipe.yml /etc/ublue-recipe.yml # yq used in build.sh and the setup-flatpaks recipe to read the recipe.yml diff --git a/build.sh b/build.sh index 45bdb84..897789e 100644 --- a/build.sh +++ b/build.sh @@ -7,4 +7,7 @@ for pkg in $rpm_packages; do \ echo "Installing: ${pkg}" && \ rpm-ostree install $pkg; \ done -echo "---" \ No newline at end of file +echo "---" + +# install yafti to install flatpaks on first boot, https://github.com/ublue-os/yafti +pip install --prefix=/usr yafti \ No newline at end of file diff --git a/etc/profile.d/ublue-firstboot.sh b/etc/profile.d/ublue-firstboot.sh index 2340d8a..62818cd 100644 --- a/etc/profile.d/ublue-firstboot.sh +++ b/etc/profile.d/ublue-firstboot.sh @@ -1,6 +1,6 @@ if test "$(id -u)" -gt "0" && test -d "$HOME"; then - if test ! -e "$HOME"/.config/ublue/firstboot-done; then + if test ! -e "$HOME"/.config/autostart/ublue-firstboot.desktop; then mkdir -p "$HOME"/.config/autostart cp -f /etc/skel.d/.config/autostart/ublue-firstboot.desktop "$HOME"/.config/autostart fi -fi +fi \ No newline at end of file diff --git a/etc/skel.d/.config/autostart/ublue-firstboot.desktop b/etc/skel.d/.config/autostart/ublue-firstboot.desktop index eb1636d..94e94d2 100644 --- a/etc/skel.d/.config/autostart/ublue-firstboot.desktop +++ b/etc/skel.d/.config/autostart/ublue-firstboot.desktop @@ -1,8 +1,8 @@ [Desktop Entry] -Name=Ublue Desktop FirstBoot Setup -Comment=Sets up Ublue Desktop Correctly On FirstBoot -Exec=/usr/bin/ublue-firstboot +Name=uBlue First Boot Setup +Comment=Sets up uBlue Desktop Correctly On FirstBoot +Exec=/usr/bin/yafti /etc/yafti.yml Icon=org.gnome.Terminal Type=Application Categories=Utility;System; -Name[en_US]=startup +Name[en_US]=startup \ No newline at end of file From f9a1561f2c8a718890f4d932db8ce625342610e2 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:03:13 +0300 Subject: [PATCH 2/9] feat: add yafti.yml from bluefin *with minor modifications, bluefin replaced with uBlue --- etc/yafti.yml | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 etc/yafti.yml diff --git a/etc/yafti.yml b/etc/yafti.yml new file mode 100644 index 0000000..655e788 --- /dev/null +++ b/etc/yafti.yml @@ -0,0 +1,109 @@ +title: Welcome to uBlue +properties: + mode: "run-on-change" +screens: + first-screen: + source: yafti.screen.title + values: + title: "Welcome to uBlue (Alpha)" + icon: "/path/to/icon" + description: | + Pick some applications to get started + can-we-modify-your-flatpaks: + source: yafti.screen.consent + values: + title: Welcome, Traveler + condition: + run: flatpak remotes --system | grep fedora + description: | + WARNING: This will modify your Flatpaks if you are rebasing! If you do not want to do this exit the installer. + actions: + - run: flatpak remote-delete fedora --force + - run: flatpak remove --system --noninteractive --all + - run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo + applications: + source: yafti.screen.package + values: + title: Application Installation + show_terminal: true + package_manager: yafti.plugin.flatpak + groups: + Core: + description: Core Applications + default: true + packages: + - Backup: org.gnome.DejaDup + - Calculator: org.gnome.Calculator + - Calendar: org.gnome.Calendar + - Characters: org.gnome.Characters + - Connections: org.gnome.Connections + - Contacts: org.gnome.Contacts + - Document Viewer: org.gnome.Evince + - Extensions Manager: com.mattjakeman.ExtensionManager + - Fedora Media Writer: org.fedoraproject.MediaWriter + - Mozilla Firefox: org.mozilla.firefox + - Flatseal Permissions Manager: com.github.tchx84.Flatseal + - Logs: org.gnome.Logs + - Maps: org.gnome.Maps + - Nautilus Preview: org.gnome.NautilusPreviewer + - Text Editor: org.gnome.TextEditor + - Weather: org.gnome.Weather + - Disk Usage Analyzer: org.gnome.baobab + - Clocks: org.gnome.clocks + - Picture Viewer: org.gnome.eog + - Font Viewer: org.gnome.font-viewer + - Font Downloader: org.gustavoperedo.FontDownloader + Web Browsers: + description: Additional browsers to complement Firefox + default: false + packages: + - Brave: com.brave.Browser + - Google Chrome: com.google.Chrome + - Microsoft Edge: com.microsoft.Edge + - Opera: com.opera.Opera + Gaming: + description: "Rock and Stone!" + default: false + packages: + - Bottles: com.usebottles.bottles + - Discord: com.discordapp.Discord + - Games: org.gnome.Games + - Heroic Games Launcher: com.heroicgameslauncher.hgl + - MangoHUD: org.freedesktop.Platform.VulkanLayer.MangoHud//22.08 + - Steam: com.valvesoftware.Steam + - Gamescope for Steam: com.valvesoftware.Steam.Utility.gamescope + - Proton Updater for Steam: net.davidotek.pupgui2 + Office: + description: Bow to Capitalism + default: false + packages: + - LibreOffice: org.libreoffice.LibreOffice + - Obsidian: md.obsidian.Obsidian + - OnlyOffice: org.onlyoffice.desktopeditors + - Slack: com.slack.Slack + - Standard Notes: org.standardnotes.standardnotes + - Thunderbird Email: org.mozilla.Thunderbird + Streaming: + description: Stream to the Internet + default: false + packages: + - OBS Studio: com.obsproject.Studio + - VkCapture for OBS: com.obsproject.Studio.OBSVkCapture + - Gstreamer for OBS: com.obsproject.Studio.Plugin.Gstreamer + - Gstreamer VAAPI for OBS: com.obsproject.Studio.Plugin.GStreamerVaapi + - Boatswain for Streamdeck: com.feaneron.Boatswain + + final-screen: + source: yafti.screen.title + values: + title: "All done!" + icon: "/path/to/icon" + links: + - "Install More Applications": + run: /usr/bin/gnome-software + - "Website": + run: /usr/bin/xdg-open https://ublue.it + - "Join the Discord Community": + run: /usr/bin/xdg-open https://discord.gg/XjG48C7VHx + description: | + Thanks for trying uBlue, we hope you enjoy it! From 0cf6b13b6c44135848ae9a400b2fa3aa5aed657d Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:24:32 +0300 Subject: [PATCH 3/9] feat: yafti package group for recipe.yml read .flatpaks[] in recipe.yml and add declared packages to their own package group in yafti --- build.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 897789e..a50e526 100644 --- a/build.sh +++ b/build.sh @@ -10,4 +10,12 @@ done echo "---" # install yafti to install flatpaks on first boot, https://github.com/ublue-os/yafti -pip install --prefix=/usr yafti \ No newline at end of file +pip install --prefix=/usr yafti + +# add a package group for yafti using the packages defined in recipe.yml +yq -iy '.screens.applications.values.groups.Custom.description = "Flatpaks defined by the image maintainer"' /etc/yafti.yml +yq -iy '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml +flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml) +for pkg in $flatpaks; do \ + yq -iy ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml \ +done From 5a98ef653293d5d3a9b4f0920d3625291a93601a Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:38:06 +0300 Subject: [PATCH 4/9] fix: remove -y flag from yq; not in go version --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index a50e526..b09bee6 100644 --- a/build.sh +++ b/build.sh @@ -13,9 +13,9 @@ echo "---" pip install --prefix=/usr yafti # add a package group for yafti using the packages defined in recipe.yml -yq -iy '.screens.applications.values.groups.Custom.description = "Flatpaks defined by the image maintainer"' /etc/yafti.yml -yq -iy '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml +yq -i '.screens.applications.values.groups.Custom.description = "Flatpaks defined by the image maintainer"' /etc/yafti.yml +yq -i '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml) for pkg in $flatpaks; do \ - yq -iy ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml \ + yq -i ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml \ done From 616c59c90bebd1d4dda24d5c28fa35adb067b13a Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:48:03 +0300 Subject: [PATCH 5/9] fix: remove unneeded escape --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index b09bee6..5fb9a31 100644 --- a/build.sh +++ b/build.sh @@ -17,5 +17,5 @@ yq -i '.screens.applications.values.groups.Custom.description = "Flatpaks define yq -i '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml) for pkg in $flatpaks; do \ - yq -i ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml \ + yq -i ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml done From 97ee7169f4a287520b516bc377b90046b717daaf Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:48:14 +0300 Subject: [PATCH 6/9] fix: add shebang --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index 5fb9a31..e23c004 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,4 @@ +#!/bin/bash # remove the default firefox (from fedora) in favor of the flatpak rpm-ostree override remove firefox firefox-langpacks From 9e827fe6be1495221cecc83746d266a78c55ba96 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 12:50:53 +0300 Subject: [PATCH 7/9] fix: add pip for yafti, remove zenity (unneeded) --- recipe.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe.yml b/recipe.yml index cb01c72..02f49df 100644 --- a/recipe.yml +++ b/recipe.yml @@ -1,5 +1,5 @@ rpms: - - zenity + - python3-pip # needed for yafti flatpaks: - org.mozilla.firefox - org.mozilla.Thunderbird From 773fc23804d7f6d5c044d46c28564a62d709f171 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 15:31:01 +0300 Subject: [PATCH 8/9] fix: loop over lines, functional var substitution --- build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index e23c004..590ab7a 100644 --- a/build.sh +++ b/build.sh @@ -4,7 +4,7 @@ rpm-ostree override remove firefox firefox-langpacks echo "-- Installing RPMs defined in recipe.yml --" rpm_packages=$(yq '.rpms[]' < /etc/ublue-recipe.yml) -for pkg in $rpm_packages; do \ +for pkg in $(echo -e "$rpm_packages"); do \ echo "Installing: ${pkg}" && \ rpm-ostree install $pkg; \ done @@ -17,6 +17,6 @@ pip install --prefix=/usr yafti yq -i '.screens.applications.values.groups.Custom.description = "Flatpaks defined by the image maintainer"' /etc/yafti.yml yq -i '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml) -for pkg in $flatpaks; do \ - yq -i ".screens.applications.values.groups.Custom.packages += [{'$pkg': '$pkg'}]" /etc/yafti.yml +for pkg in $(echo -e "$flatpaks"); do \ + yq -i ".screens.applications.values.groups.Custom.packages += [{\"$pkg\": \"$pkg\"}]" /etc/yafti.yml done From e9c31aba83b4a158c47c0306e9fecd9d00c4ffa9 Mon Sep 17 00:00:00 2001 From: ER Date: Sun, 2 Apr 2023 15:51:18 +0300 Subject: [PATCH 9/9] chore: put ublue-recipe in /tmp -> there's no reason to send the recipe to the client as it is only used in the build stages --- Containerfile | 2 +- build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Containerfile b/Containerfile index e40ea7c..6245b2b 100644 --- a/Containerfile +++ b/Containerfile @@ -7,7 +7,7 @@ FROM ghcr.io/ublue-os/silverblue-main:${FEDORA_MAJOR_VERSION} COPY etc /etc # COPY usr /usr -COPY recipe.yml /etc/ublue-recipe.yml +COPY recipe.yml /tmp/ublue-recipe.yml # yq used in build.sh and the setup-flatpaks recipe to read the recipe.yml # copied from the official container image as it's not avaible as an rpm diff --git a/build.sh b/build.sh index 590ab7a..231260c 100644 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ rpm-ostree override remove firefox firefox-langpacks echo "-- Installing RPMs defined in recipe.yml --" -rpm_packages=$(yq '.rpms[]' < /etc/ublue-recipe.yml) +rpm_packages=$(yq '.rpms[]' < /tmp/ublue-recipe.yml) for pkg in $(echo -e "$rpm_packages"); do \ echo "Installing: ${pkg}" && \ rpm-ostree install $pkg; \ @@ -16,7 +16,7 @@ pip install --prefix=/usr yafti # add a package group for yafti using the packages defined in recipe.yml yq -i '.screens.applications.values.groups.Custom.description = "Flatpaks defined by the image maintainer"' /etc/yafti.yml yq -i '.screens.applications.values.groups.Custom.default = true' /etc/yafti.yml -flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml) +flatpaks=$(yq '.flatpaks[]' < /tmp/ublue-recipe.yml) for pkg in $(echo -e "$flatpaks"); do \ yq -i ".screens.applications.values.groups.Custom.packages += [{\"$pkg\": \"$pkg\"}]" /etc/yafti.yml done