Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

feat: ease customization by reading flatpaks and rpms to install from a recipe.yml. #79

Merged
merged 13 commits into from
Feb 28, 2023
Merged
20 changes: 19 additions & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,26 @@ COPY usr /usr

COPY ublue-firstboot /usr/bin

COPY recipe.yml /etc/ublue-recipe.yml

# https://github.com/TomWright/dasel is a single-binary program used for reading the recipe.yml.
# It is not available as an rpm.
RUN curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o /usr/bin/dasel && \
castrojo marked this conversation as resolved.
Show resolved Hide resolved
chmod +x /usr/bin/dasel

RUN rpm-ostree override remove firefox firefox-langpacks && \
rpm-ostree install distrobox gnome-tweaks just vte291-gtk4-devel vanilla-first-setup && \
rpm-ostree install vte291-gtk4-devel vanilla-first-setup && \

echo "-- Installing RPMs defined in recipe.yml --" && \
rpm_packages=$(dasel -f /etc/ublue-recipe.yml -r yaml -w json -s 'rpm_packages') && \
rpm_packages_count=$(echo $rpm_packages | dasel -r json -s 'len()') && \
for i in $( seq 0 $(($rpm_packages_count-1)) ); do \
pkg=$(echo $rpm_packages | dasel -r json "[${i}]" | tr -d '"') && \
echo "Installing: ${pkg}" && \
rpm-ostree install $pkg; \
marcoceppi marked this conversation as resolved.
Show resolved Hide resolved
done && \
echo "---" && \

sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \
systemctl enable rpm-ostreed-automatic.timer && \
systemctl enable flatpak-system-update.timer && \
Expand Down
9 changes: 9 additions & 0 deletions etc/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ distrobox-ubuntu:
echo 'Creating Ubuntu distrobox ...'
distrobox create --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y

install-recipe-flatpaks:
xynydev marked this conversation as resolved.
Show resolved Hide resolved
flatpaks=$(dasel -f /etc/ublue-recipe.yml -r yaml -w json -s 'flatpaks')
flatpaks_count=$(echo $flatpaks | dasel -r json -s 'len()')
for i in $(seq 0 $(($flatpaks_count-1))); do
pkg=$(echo $flatpaks | dasel -r json "[${i}]" | tr -d '"')
echo "# Installing ${pkg}"
flatpak install --user --noninteractive flathub $pkg
done

setup-flatpaks:
echo 'Setting up your flatpaks...'
flatpak install -y --user \\
Expand Down
13 changes: 13 additions & 0 deletions recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rpm_packages:
- distrobox
- gnome-tweaks
- just
flatpaks:
- org.mozilla.firefox
- org.mozilla.Thunderbird
- com.mattjakeman.ExtensionManager
- org.libreoffice.LibreOffice
- org.gnome.DejaDup
- org.gustavoperedo.FontDownloader
- com.github.tchx84.Flatseal
- io.github.celluloid_player.Celluloid
85 changes: 16 additions & 69 deletions ublue-firstboot
Original file line number Diff line number Diff line change
Expand Up @@ -55,77 +55,24 @@ if [ "$?" != 0 ] ; then
fi
echo "25"

echo "# Installing Firefox"
/usr/bin/flatpak install --user --noninteractive flathub org.mozilla.firefox
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Firefox Failed"
exit 1
fi
echo "30"
echo "# Installing flatpaks from recipe"
flatpaks=$(dasel -f /etc/ublue-recipe.yml -r yaml -w json -s 'flatpaks')
flatpaks_count=$(echo $flatpaks | dasel -r json -s 'len()')

for i in $(seq 0 $(($flatpaks_count-1))); do
pkg=$(echo $flatpaks | dasel -r json "[${i}]" | tr -d '"')
echo "# Installing ${pkg}"
/usr/bin/flatpak install --user --noninteractive flathub $pkg
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing ${pkg} Failed"
exit 1
fi
# Automatically calculates evenly spaced progess using bc, cuts everything after decimal point.
xynydev marked this conversation as resolved.
Show resolved Hide resolved
echo "${i}/${flatpaks_count} * (95-30) + 30" | bc -l | cut -d "." -f1
done

echo "# Installing Thunderbird"
/usr/bin/flatpak install --user --noninteractive flathub org.mozilla.Thunderbird
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Thunderbird Failed"
exit 1
fi
echo "40"

echo "# Installing Extension Manager"
/usr/bin/flatpak install --user --noninteractive flathub com.mattjakeman.ExtensionManager
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Extension Manager Failed"
exit 1
fi
echo "50"

echo "# Installing LibreOffice"
/usr/bin/flatpak install --user --noninteractive flathub org.libreoffice.LibreOffice
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing LibreOffice Failed"
exit 1
fi
echo "70"

echo "# Installing DejaDup Backup"
/usr/bin/flatpak install --user --noninteractive flathub org.gnome.DejaDup
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing DejaDup Failed"
exit 1
fi
echo "80"

echo "# Installing Font Downloader"
/usr/bin/flatpak install --user --noninteractive flathub org.gustavoperedo.FontDownloader
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing FontDownloader Failed"
exit 1
fi
echo "85"

echo "# Installing Flatseal"
/usr/bin/flatpak install --user --noninteractive flathub com.github.tchx84.Flatseal
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Flatseal Failed"
exit 1
fi
echo "90"

echo "# Installing Celluloid Media Player"
/usr/bin/flatpak install --user --noninteractive flathub io.github.celluloid_player.Celluloid
if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing Celluloid Failed"
exit 1
fi
echo "95"

echo "Enabling Flatpak auto update"
/usr/bin/systemctl --user enable --now flatpak-user-update.timer
Expand Down