From 87f73f2797ff8d6ffb5115f49c91719edf8b23d1 Mon Sep 17 00:00:00 2001 From: humocs-man <251756307+humocs-man@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:32:09 +0100 Subject: [PATCH] first-boot-logic --- .../90-fluffy-pancake-firstboot.preset | 1 + .../system/fluffy-pancake-firstboot.service | 13 ++++++ files/usr/libexec/fluffy-pancake/firstboot.sh | 40 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 files/usr/lib/system-preset/90-fluffy-pancake-firstboot.preset create mode 100644 files/usr/lib/system/fluffy-pancake-firstboot.service create mode 100755 files/usr/libexec/fluffy-pancake/firstboot.sh diff --git a/files/usr/lib/system-preset/90-fluffy-pancake-firstboot.preset b/files/usr/lib/system-preset/90-fluffy-pancake-firstboot.preset new file mode 100644 index 0000000..ced0dcc --- /dev/null +++ b/files/usr/lib/system-preset/90-fluffy-pancake-firstboot.preset @@ -0,0 +1 @@ +enable fluffy-pancake-firstboot.service diff --git a/files/usr/lib/system/fluffy-pancake-firstboot.service b/files/usr/lib/system/fluffy-pancake-firstboot.service new file mode 100644 index 0000000..c75c48a --- /dev/null +++ b/files/usr/lib/system/fluffy-pancake-firstboot.service @@ -0,0 +1,13 @@ +[Unit] +Description=Fluffy Pancake First Boot Initialization +ConditionFirstBoot=yes +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/libexec/fluffy-pancake/firstboot.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/files/usr/libexec/fluffy-pancake/firstboot.sh b/files/usr/libexec/fluffy-pancake/firstboot.sh new file mode 100755 index 0000000..1e2c96c --- /dev/null +++ b/files/usr/libexec/fluffy-pancake/firstboot.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "[firstboot] Starting first boot initialization" + +# ------------------------------------------------------------------- +# Initialize Homebrew (no updates, no network dependency) +# ------------------------------------------------------------------- +if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then + echo "[firstboot] Initializing Homebrew environment" + + export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" + export HOMEBREW_CELLAR="$HOMEBREW_PREFIX/Cellar" + export HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX/Homebrew" + export PATH="$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:$PATH" + + brew config >/dev/null +else + echo "[firstboot] Homebrew not present, skipping" +fi + +# ------------------------------------------------------------------- +# Ensure Flathub exists +# ------------------------------------------------------------------- +if ! flatpak remote-list --system | grep -q '^flathub'; then + echo "[firstboot] Adding Flathub remote" + flatpak remote-add --system --if-not-exists flathub \ + https://flathub.org/repo/flathub.flatpakrepo +fi + +# ------------------------------------------------------------------- +# Flatpak preinstall +# ------------------------------------------------------------------- +echo "[firstboot] Installing Flatpaks" + +flatpak install --system --noninteractive flathub \ + org.mozilla.firefox \ + org.gnome.Calculator + +echo "[firstboot] First boot initialization complete"