Clean up the online installer

This commit is contained in:
David Heinemeier Hansson committed 2025-08-20 09:37:18 +02:00
1 parent e2183fefee
commit cb078cc13a
14 files changed
+59 -111

No files matched your search

+6 -12
View File
@@ -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"
File renamed without changes.
+14 -81
View File
@@ -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="$(<user_full_name.txt)" \
OMARCHY_USER_EMAIL="$(<user_email_address.txt)" \
/bin/bash -lc "wget -qO- https://omarchy.org/install-dev | bash"
fi
_EOF_
cp /builder/cmds/autostart-installer.sh "$cache_dir/airootfs/root/.automated_script.sh"
# We patch permissions, grub and efi loaders to our liking:
(cd $cache_dir/ && git apply /permissions.patch)
(cd $cache_dir/ && git apply /grub-autoboot.patch)
(cd $cache_dir/ && git apply /efi-autoboot.patch)
# We could also use:
# patch -p1 < aur-mirror.patch
# patch -p1 < permissions.patch
# patch -p1 < grub-autoboot.patch
# patch -p1 < efi-autoboot.patch
(cd $cache_dir/ && git apply /builder/patches/permissions-online.patch)
(cd $cache_dir/ && git apply /builder/patches/grub-autoboot.patch)
(cd $cache_dir/ && git apply /builder/patches/efi-autoboot.patch)
# Remove the default motd
rm "$cache_dir/airootfs/etc/motd"
# Install Python packages for the installer into the ISO
# file system.
pip install "${python_packages[@]}"
# Add our needed packages to packages.x86_64
printf '%s\n' "${arch_packages[@]}" >>"$cache_dir/packages.x86_64"
+26
View File
@@ -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="$(<user_full_name.txt)" \
OMARCHY_USER_EMAIL="$(<user_email_address.txt)" \
/bin/bash -lc "wget -qO- https://omarchy.org/install-dev | bash"
fi
+3
View File
@@ -0,0 +1,3 @@
# Omarchy ISO - Allow passwordless sudo during installation
root ALL=(ALL:ALL) NOPASSWD: ALL
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
File renamed without changes.
@@ -140,10 +140,3 @@ dart
qt5-remoteobjects
dust
starship
limine
limine-mkinitcpio-hook
limine-snapper-sync
snapper
# the limine hook and sync needed
# JDK17 to build, maybe a runtime dep too?
# java-17-openjdk
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+10
View File
@@ -0,0 +1,10 @@
--- a/profiledef.sh
+++ b/profiledef.sh
@@ -22,6 +22,5 @@ file_permissions=(
["/root/.automated_script.sh"]="0:0:755"
["/root/.gnupg"]="0:0:700"
["/usr/local/bin/choose-mirror"]="0:0:755"
- ["/usr/local/bin/Installation_guide"]="0:0:755"
- ["/usr/local/bin/livecd-sound"]="0:0:755"
+ ["/root/installer"]="0:0:755"
)
File renamed without changes.
-11
View File
@@ -1,11 +0,0 @@
#!/bin/bash
check_connectivity() {
curl -s --connect-timeout 5 https://omarchy.org/ > /dev/null
}
INTERNET=`check_connectivity`
while ! $INTERNET; do
impala
INTERNET=`check_connectivity`
done