Files
secureblue/ublue-firstboot
2023-01-16 22:37:32 -05:00

142 lines
3.8 KiB
Bash
Executable File

#!/bin/sh
if test -e "$HOME"/.config/ublue/firstboot-done; then
echo "Already ran"
exit 0
fi
(
echo "# Waiting for Internet connection"
until /usr/bin/ping -q -c 1 flathub.org; do sleep 1; done
echo "00"
echo "# Removing Filtered Flathub Repository"
/usr/bin/flatpak remote-delete flathub --force ||:
if [ "$?" != 0 ] ; then
zenity --error \
--text="Removing Filtered Flathub Repo Failed"
exit 1
fi
echo "3"
echo "# Enabling Flathub Repository"
/usr/bin/flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
if [ "$?" != 0 ] ; then
zenity --error \
--text="Adding Flathub Repo Failed"
exit 1
fi
echo "5"
echo "# Replacing Fedora Flatpaks with Flathub Ones (this may take a while)"
/usr/bin/flatpak install --user --noninteractive org.gnome.Platform//43
/usr/bin/flatpak install --user --noninteractive --reinstall flathub $(flatpak list --app-runtime=org.fedoraproject.Platform --columns=application | tail -n +1 )
if [ "$?" != 0 ] ; then
zenity --error \
--text="Replacing Fedora Flatpaks Failed"
exit 1
fi
echo "20"
echo "Removing all preinstalled Flatpaks"
/usr/bin/flatpak remove --system --noninteractive --all ||:
if [ "$?" != 0 ] ; then
zenity --error \
--text="Removing all preinstalled flatpaks failed"
exit 1
fi
echo "# Removing Fedora Flatpak Repository"
/usr/bin/flatpak remote-delete fedora --force ||:
if [ "$?" != 0 ] ; then
zenity --error \
--text="Removing Fedora Flatpak Repo Failed"
exit 1
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 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 "100"
echo "# Reticulating Final Splines"
mkdir -p "$HOME"/.config/ublue/
touch "$HOME"/.config/ublue/firstboot-done
cp -n /etc/justfile "$HOME"/.justfile
) |
zenity --progress --title="uBlue Desktop Firstboot" --percentage=0 --auto-close --no-cancel --width=300
if [ "$?" != 0 ] ; then
zenity --error \
--text="Firstboot Configuration Error"
fi