diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..a5ba022 --- /dev/null +++ b/Containerfile @@ -0,0 +1,16 @@ +FROM ghcr.io/cgwalters/fedora-silverblue:37 +# See https://pagure.io/releng/issue/11047 for final location + +COPY etc /etc +COPY usr /usr + +COPY ublue-firstboot /usr/bin + +RUN rpm-ostree override remove firefox firefox-langpacks && \ + rpm-ostree install distrobox gnome-tweaks && \ + sed -i 's/#AutomaticUpdatePolicy.*/AutomaticUpdatePolicy=stage/' /etc/rpm-ostreed.conf && \ + systemctl enable rpm-ostreed-automatic.timer && \ + systemctl enable flatpak-automatic.timer && \ + dconf update && \ + rpm-ostree cleanup -m && \ + ostree container commit \ No newline at end of file diff --git a/etc/profile.d/ublue-firstboot.sh b/etc/profile.d/ublue-firstboot.sh new file mode 100644 index 0000000..2340d8a --- /dev/null +++ b/etc/profile.d/ublue-firstboot.sh @@ -0,0 +1,6 @@ +if test "$(id -u)" -gt "0" && test -d "$HOME"; then + if test ! -e "$HOME"/.config/ublue/firstboot-done; then + mkdir -p "$HOME"/.config/autostart + cp -f /etc/skel.d/.config/autostart/ublue-firstboot.desktop "$HOME"/.config/autostart + fi +fi diff --git a/etc/skel.d/.config/autostart/ublue-firstboot.desktop b/etc/skel.d/.config/autostart/ublue-firstboot.desktop new file mode 100644 index 0000000..eb1636d --- /dev/null +++ b/etc/skel.d/.config/autostart/ublue-firstboot.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Ublue Desktop FirstBoot Setup +Comment=Sets up Ublue Desktop Correctly On FirstBoot +Exec=/usr/bin/ublue-firstboot +Icon=org.gnome.Terminal +Type=Application +Categories=Utility;System; +Name[en_US]=startup diff --git a/etc/systemd/system/flatpak-automatic.service b/etc/systemd/system/flatpak-automatic.service new file mode 100644 index 0000000..140f6f5 --- /dev/null +++ b/etc/systemd/system/flatpak-automatic.service @@ -0,0 +1,12 @@ +[Unit] +Description=flatpak Automatic Update +Documentation=man:flatpak(1) +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/flatpak update -y + +[Install] +WantedBy=multi-user.target diff --git a/etc/systemd/system/flatpak-automatic.timer b/etc/systemd/system/flatpak-automatic.timer new file mode 100644 index 0000000..108b997 --- /dev/null +++ b/etc/systemd/system/flatpak-automatic.timer @@ -0,0 +1,11 @@ +[Unit] +Description=flatpak Automatic Update Trigger +Documentation=man:flatpak(1) + +[Timer] +OnBootSec=5m +OnCalendar=0/6:00:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/ublue-firstboot b/ublue-firstboot new file mode 100755 index 0000000..0aaf75c --- /dev/null +++ b/ublue-firstboot @@ -0,0 +1,153 @@ +#!/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 "# 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 "7" + +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 "10" + +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 "20" + +echo "# Installing GNOME Applications" +/usr/bin/flatpak install --user --noninteractive flathub \ + org.gnome.Calculator \ + org.gnome.Calendar \ + org.gnome.Characters \ + org.gnome.Connections \ + org.gnome.Contacts \ + org.gnome.Evince \ + org.gnome.Firmware \ + org.gnome.Logs +if [ "$?" != 0 ] ; then + zenity --error \ + --text="Installing GNOME Applications Failed" + exit 1 +fi +echo "30" + +echo "# Installing more GNOME Applications" +/usr/bin/flatpak install --user --noninteractive flathub \ + org.gnome.Maps \ + org.gnome.NautilusPreviewer \ + org.gnome.TextEditor \ + org.gnome.Weather \ + org.gnome.baobab \ + org.gnome.clocks \ + org.gnome.eog \ + org.gnome.font-viewer +if [ "$?" != 0 ] ; then + zenity --error \ + --text="Installing GNOME more Applications 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 + +if [ "$?" != 0 ] ; then + zenity --error \ + --text="Firstboot Configuration Error" +fi \ No newline at end of file