From cb078cc13a61059774ddf1ae174ccecd89e2538d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 20 Aug 2025 09:37:18 +0200 Subject: [PATCH] Clean up the online installer --- bin/omarchy-iso-make | 18 ++-- build_iso.sh => build_offline_iso.sh | 0 build_online_iso.sh | 95 +++---------------- builder/cmds/autostart-installer.sh | 26 +++++ builder/configs/sudo-less-installation | 3 + .../packages/archinstall.packages | 0 .../packages/omarchy.packages | 7 -- .../patches/aur-mirror.patch | 0 .../patches/efi-autoboot.patch | 0 .../patches/grub-autoboot.patch | 0 .../patches/offline-mirror.patch | 0 builder/patches/permissions-online.patch | 10 ++ .../patches/permissions.patch | 0 check_connectivity.sh | 11 --- 14 files changed, 59 insertions(+), 111 deletions(-) rename build_iso.sh => build_offline_iso.sh (100%) create mode 100644 builder/cmds/autostart-installer.sh create mode 100644 builder/configs/sudo-less-installation rename archinstall.packages => builder/packages/archinstall.packages (100%) rename omarchy.packages => builder/packages/omarchy.packages (90%) rename aur-mirror.patch => builder/patches/aur-mirror.patch (100%) rename efi-autoboot.patch => builder/patches/efi-autoboot.patch (100%) rename grub-autoboot.patch => builder/patches/grub-autoboot.patch (100%) rename offline-mirror.patch => builder/patches/offline-mirror.patch (100%) create mode 100644 builder/patches/permissions-online.patch rename permissions.patch => builder/patches/permissions.patch (100%) delete mode 100755 check_connectivity.sh diff --git a/bin/omarchy-iso-make b/bin/omarchy-iso-make index 4f0e54b..95040c0 100755 --- a/bin/omarchy-iso-make +++ b/bin/omarchy-iso-make @@ -1,13 +1,14 @@ #!/bin/bash +# Abort if anything fails set -e # Ensure we have the submodule checked out git submodule update --init --recursive --jobs=8 # Prepare build repo -BUILD_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -mkdir -p "$BUILD_ROOT/out" +BUILD_ROOT="$(realpath "${BASH_SOURCE[0]%/*}/..")" +mkdir -p "$BUILD_ROOT/release" # Determine which build script to use if [[ $1 == "--offline" ]]; then @@ -19,18 +20,11 @@ fi # Run the builder docker run --rm \ --privileged \ - -v "$BUILD_ROOT/out/:/out/" \ + -v "$BUILD_ROOT/release/:/out/" \ -v "$BUILD_ROOT/$BUILD_SCRIPT:/$BUILD_SCRIPT:ro" \ -v "$BUILD_ROOT/archiso:/archiso:ro" \ - -v "$BUILD_ROOT/grub-autoboot.patch:/grub-autoboot.patch:ro" \ - -v "$BUILD_ROOT/efi-autoboot.patch:/efi-autoboot.patch:ro" \ - -v "$BUILD_ROOT/permissions.patch:/permissions.patch:ro" \ - -v "$BUILD_ROOT/aur-mirror.patch:/aur-mirror.patch:ro" \ - -v "$BUILD_ROOT/offline-mirror.patch:/offline-mirror.patch:ro" \ - -v "$BUILD_ROOT/check_connectivity.sh:/check_connectivity.sh:ro" \ - -v "$BUILD_ROOT/omarchy.packages:/omarchy.packages:ro" \ - -v "$BUILD_ROOT/archinstall.packages:/archinstall.packages:ro" \ + -v "$BUILD_ROOT/builder:/builder:ro" \ archlinux/archlinux:latest /$BUILD_SCRIPT # Make iso accessible to all -sudo chmod 777 -R "$BUILD_ROOT/out" +sudo chmod 777 -R "$BUILD_ROOT/release" diff --git a/build_iso.sh b/build_offline_iso.sh similarity index 100% rename from build_iso.sh rename to build_offline_iso.sh diff --git a/build_online_iso.sh b/build_online_iso.sh index 155db86..fd9c598 100755 --- a/build_online_iso.sh +++ b/build_online_iso.sh @@ -2,108 +2,41 @@ set -e -# Note that these are packages installed to the Arch container -# used to build the ISO. +# Note that these are packages installed to the Arch container used to build the ISO. pacman-key --init -pacman --noconfirm -Sy archlinux-keyring -pacman --noconfirm -Sy archiso git python-pip sudo base-devel jq wget +pacman --noconfirm -Sy archlinux-keyring archiso sudo base-devel wget git +# Packages needed for when we run the Omarchy installer +arch_packages=(git wget gum openssl iw) + +# We build our iso here cache_dir=$(realpath --canonicalize-missing ~/.cache/omarchy/iso_$(date +%Y-%m-%d)) -offline_mirror_dir="$cache_dir/airootfs/var/cache/omarchy/mirror/offline" - -# We need to fiddle with pip settings -# in order to install to the correct place -# as well as ignore some errors to make this less verbose -export PIP_ROOT="$cache_dir/airootfs/" -export PIP_ROOT_USER_ACTION="ignore" -export PIP_NO_WARN_SCRIPT_LOCATION=1 -export PIP_BREAK_SYSTEM_PACKAGES=1 - -# These packages will be installed **into** the ISO, and -# won't be available to either archinstall or omarchy installer. -python_packages=( - terminaltexteffects -) -arch_packages=( - git - gum - openssl - wget -) - mkdir -p $cache_dir/ -mkdir -p $offline_mirror_dir/ # We base our ISO on the official arch ISO (releng) config cp -r archiso/configs/releng/* $cache_dir/ -# We clone the installer, and move it to the root users home folder -# since this is the default user in the official releng ISO profile. -git clone https://github.com/omacom-io/omarchy-installer "$cache_dir/airootfs/root/omarchy-installer" -mv "$cache_dir/airootfs/root/omarchy-installer/installer" "$cache_dir/airootfs/root/installer" -mv "$cache_dir/airootfs/root/omarchy-installer/logo.txt" "$cache_dir/airootfs/root/logo.txt" -rm -rf "$cache_dir/airootfs/root/omarchy-installer" - -# Copy in the connectivity check script -cp /check_connectivity.sh "$cache_dir/airootfs/root/check_connectivity.sh" +# Insert the configurator in the root users home folder (default user in the official releng ISO profile). +wget -qO "$cache_dir/airootfs/root/installer" https://raw.githubusercontent.com/omacom-io/omarchy-installer/HEAD/installer # Configure sudoers for passwordless installation # This allows the installer to run without password prompts -mkdir -p $cache_dir/airootfs/etc/sudoers.d/ -echo "# Omarchy ISO - Allow passwordless sudo during installation" >>"$cache_dir/airootfs/etc/sudoers.d/99-omarchy-installer" -echo "root ALL=(ALL:ALL) NOPASSWD: ALL" >>"$cache_dir/airootfs/etc/sudoers.d/99-omarchy-installer" -echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >>"$cache_dir/airootfs/etc/sudoers.d/99-omarchy-installer" +mkdir -p "$cache_dir/airootfs/etc/sudoers.d" +cp /builder/configs/sudo-less-installation "$cache_dir/airootfs/etc/sudoers.d/99-omarchy-installer" # We add in our auto-start applications # First we'll check for an active internet connection # Then we'll start the omarchy installer -cat <<-'_EOF_' | tee "$cache_dir/airootfs/root/.automated_script.sh" - #!/usr/bin/env bash - set -euo pipefail - - if [[ $(tty) == "/dev/tty1" ]]; then - sh ./check_connectivity.sh - sh ./installer - - archinstall \ - --config user_configuration.json \ - --creds user_credentials.json \ - --silent - - OMARCHY_USER="$(ls -1 /mnt/home | head -n1)" - - # Copy sudoers config to target system for passwordless sudo in chroot - mkdir -p /mnt/etc/sudoers.d - cp /etc/sudoers.d/99-omarchy-installer /mnt/etc/sudoers.d/ - - # Also ensure the user can run sudo without password in chroot - echo "$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /mnt/etc/sudoers.d/99-omarchy-installer - - HOME=/home/$OMARCHY_USER \ - arch-chroot -u $OMARCHY_USER /mnt/ \ - env OMARCHY_USER_NAME="$(>"$cache_dir/packages.x86_64" diff --git a/builder/cmds/autostart-installer.sh b/builder/cmds/autostart-installer.sh new file mode 100644 index 0000000..1a14b16 --- /dev/null +++ b/builder/cmds/autostart-installer.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [[ $(tty) == "/dev/tty1" ]]; then + NETWORK_NEEDED=1 sh ./installer + + archinstall \ + --config user_configuration.json \ + --creds user_credentials.json \ + --silent + + OMARCHY_USER="$(ls -1 /mnt/home | head -n1)" + + # Copy sudoers config to target system for passwordless sudo in chroot + mkdir -p /mnt/etc/sudoers.d + cp /etc/sudoers.d/99-omarchy-installer /mnt/etc/sudoers.d/ + + # Also ensure the user can run sudo without password in chroot + echo "$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL" >>/mnt/etc/sudoers.d/99-omarchy-installer + + HOME=/home/$OMARCHY_USER \ + arch-chroot -u $OMARCHY_USER /mnt/ \ + env OMARCHY_USER_NAME="$( /dev/null -} - -INTERNET=`check_connectivity` -while ! $INTERNET; do - impala - INTERNET=`check_connectivity` -done \ No newline at end of file