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

Co-authored-by: ER <eino.rauhala@proton.me>
Co-authored-by: Marco Ceppi <marco@ceppi.net>
Co-authored-by: Jorge O. Castro <jorge.castro@gmail.com>
This commit is contained in:
Eino Rauhala
2023-02-28 17:08:29 +00:00
committed by GitHub
parent a831ce00df
commit a5e90a588f
4 changed files with 49 additions and 89 deletions

View File

@@ -5,20 +5,26 @@ ARG FEDORA_MAJOR_VERSION=37
FROM quay.io/fedora-ostree-desktops/silverblue:${FEDORA_MAJOR_VERSION} FROM quay.io/fedora-ostree-desktops/silverblue:${FEDORA_MAJOR_VERSION}
# See https://pagure.io/releng/issue/11047 for final location # See https://pagure.io/releng/issue/11047 for final location
# Add Vanilla First Setup
RUN wget https://copr.fedorainfracloud.org/coprs/ublue-os/vanilla-first-setup/repo/fedora-$(rpm -E %fedora)/ublue-os-vanilla-first-setup-fedora-$(rpm -E %fedora).repo -O /etc/yum.repos.d/_copr_ublue-os-vanilla-first-setup.repo
COPY etc /etc COPY etc /etc
COPY usr /usr COPY usr /usr
COPY ublue-firstboot /usr/bin COPY ublue-firstboot /usr/bin
COPY recipe.yml /etc/ublue-recipe.yml
COPY --from=docker.io/mikefarah/yq /usr/bin/yq /usr/bin/yq
RUN rpm-ostree override remove firefox firefox-langpacks && \ RUN rpm-ostree override remove firefox firefox-langpacks && \
rpm-ostree install distrobox gnome-tweaks just vte291-gtk4-devel vanilla-first-setup && \ echo "-- Installing RPMs defined in recipe.yml --" && \
rpm_packages=$(yq '.rpms[]' < /etc/ublue-recipe.yml) && \
for pkg in $rpm_packages; do \
echo "Installing: ${pkg}" && \
rpm-ostree install $pkg; \
done && \
echo "---" && \
sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \ sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \
systemctl enable rpm-ostreed-automatic.timer && \ systemctl enable rpm-ostreed-automatic.timer && \
systemctl enable flatpak-system-update.timer && \ systemctl enable flatpak-system-update.timer && \
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_ublue-os-vanilla-first-setup.repo && \
rm -rf \ rm -rf \
/tmp/* \ /tmp/* \
/var/* && \ /var/* && \

View File

@@ -22,22 +22,16 @@ distrobox-opensuse:
distrobox-ubuntu: distrobox-ubuntu:
echo 'Creating Ubuntu distrobox ...' echo 'Creating Ubuntu distrobox ...'
distrobox create --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y distrobox create --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y
setup-flatpaks: setup-flatpaks:
echo 'Setting up your flatpaks...' echo 'Installing flatpaks from the ublue recipe ...'
flatpak install -y --user \\ flatpaks=$(dasel -f /etc/ublue-recipe.yml -r yaml -w json -s 'flatpaks')
com.discordapp.Discord \\ flatpaks_count=$(echo $flatpaks | dasel -r json -s 'len()')
com.mastermindzh.tidal-hifi \\ for i in $(seq 0 $(($flatpaks_count-1))); do
com.microsoft.Edge \\ pkg=$(echo $flatpaks | dasel -r json "[${i}]" | tr -d '"')
com.plexamp.Plexamp \\ echo "# Installing ${pkg}"
com.slack.Slack \\ flatpak install --user --noninteractive flathub $pkg
com.todoist.Todoist \\ done
com.visualstudio.code \\
im.riot.Riot \\
no.mifi.losslesscut \\
org.standardnotes.standardnotes \\
tv.plex.PlexDesktop \\
us.zoom.Zoom
setup-pwa: setup-pwa:
echo 'Giving browser permission to create PWAs (Progressive Web Apps)' echo 'Giving browser permission to create PWAs (Progressive Web Apps)'

13
recipe.yml Normal file
View File

@@ -0,0 +1,13 @@
rpms:
- 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

View File

@@ -55,77 +55,24 @@ if [ "$?" != 0 ] ; then
fi fi
echo "25" echo "25"
echo "# Installing Firefox" echo "# Installing flatpaks from recipe"
/usr/bin/flatpak install --user --noninteractive flathub org.mozilla.firefox flatpaks=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml)
if [ "$?" != 0 ] ; then flatpaks_count=$(yq '.flatpaks[]' < /etc/ublue-recipe.yml | wc -l)
zenity --error \ i=0
--text="Installing Firefox Failed" for pkg in $flatpaks; do
exit 1 echo "# Installing ${pkg}"
fi /usr/bin/flatpak install --user --noninteractive flathub $pkg
echo "30" if [ "$?" != 0 ] ; then
zenity --error \
--text="Installing ${pkg} Failed"
exit 1
fi
i=$((i+1))
# Automatically calculates evenly spaced progess using bc, cuts everything after decimal point.
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" echo "Enabling Flatpak auto update"
/usr/bin/systemctl --user enable --now flatpak-user-update.timer /usr/bin/systemctl --user enable --now flatpak-user-update.timer