Compare commits

...
4 Commits
Author SHA1 Message Date
Ryan Hughes 9a604ef1e7 Add limine 2025-11-26 01:28:23 -05:00
Ryan Hughes 9debbec097 Tail both logs to get additional output 2025-11-16 22:05:04 -05:00
Ryan Hughes 9147ed0f54 Fix builds 2025-11-16 22:04:52 -05:00
Ryan Hughes 76699b4de0 Refactor work 2025-11-16 19:31:01 -05:00
9 changed files with 757 additions and 142 deletions

No files matched your search

+31 -3
View File
@@ -57,9 +57,37 @@ DOCKER_ARGS=(
-v "$BUILD_ROOT/configs:/configs:ro"
)
# Use local source of Omarchy from $OMARCHY_PATH instead of git checkout
if [[ -n "${LOCAL_SOURCE-}" ]]; then
DOCKER_ARGS+=(-v "$OMARCHY_PATH:/omarchy:ro")
# Mount omarchy-pkgs if it exists (for local package building)
# Can be overridden with OMARCHY_PKGS_PATH environment variable
if [ -z "$OMARCHY_PKGS_PATH" ]; then
OMARCHY_PKGS_PATH="$BUILD_ROOT/../omarchy-pkgs"
fi
if [ -d "$OMARCHY_PKGS_PATH" ]; then
echo "Mounting omarchy-pkgs from: $OMARCHY_PKGS_PATH"
OMARCHY_PKGS_PATH=$(realpath "$OMARCHY_PKGS_PATH")
DOCKER_ARGS+=(-v "$OMARCHY_PKGS_PATH:/omarchy-pkgs:ro")
else
echo "Note: omarchy-pkgs not found at $OMARCHY_PKGS_PATH (build will fail)"
fi
# Mount omarchy-installer for dev builds (optional)
# Can be overridden with OMARCHY_INSTALLER_PATH environment variable
# If not set, will auto-detect ../omarchy-installer for dev builds
if [ -n "$LOCAL_SOURCE" ]; then
if [ -z "$OMARCHY_INSTALLER_PATH" ]; then
OMARCHY_INSTALLER_PATH="$BUILD_ROOT/../omarchy-installer"
fi
if [ -d "$OMARCHY_INSTALLER_PATH" ]; then
echo "Mounting omarchy-installer from: $OMARCHY_INSTALLER_PATH (dev mode)"
OMARCHY_INSTALLER_PATH=$(realpath "$OMARCHY_INSTALLER_PATH")
DOCKER_ARGS+=(-v "$OMARCHY_INSTALLER_PATH:/omarchy-installer:ro")
DOCKER_ARGS+=(-e "OMARCHY_DEV_BUILD=1")
else
echo "Note: omarchy-installer not found at $OMARCHY_INSTALLER_PATH"
echo " Will use git clone from PKGBUILD"
fi
fi
# Use local pacman cache if you already have one on host to speed up repeat runs
+143
View File
@@ -0,0 +1,143 @@
# Omarchy ISO Builder
## Overview
The ISO build system now integrates local package building for development workflows.
## Build Scripts
### build-iso.sh
Main ISO build script that:
1. Sets up Arch Linux build environment
2. Builds omarchy-settings package locally (if omarchy-pkgs mounted)
3. Installs omarchy-settings in the ISO
4. Downloads remaining packages to offline mirror
5. Assembles the final ISO image
### build-omarchy-packages.sh
Builds omarchy-settings package locally from source:
- Runs inside Docker container
- Builds as `nobody` user (makepkg requirement)
- Outputs package to `/tmp/omarchy-pkg-build/`
- Exports `OMARCHY_SETTINGS_PKG` variable for build-iso.sh
## Package Integration
### omarchy-settings
**Installed in ISO** - Provides EVERYTHING needed:
- User skeleton files (`/etc/skel/`)
- System configurations (`/etc/`)
- Plymouth boot theme
- Essential binaries (`omarchy-debug`, `omarchy-upload-log`)
- Install scripts (`/usr/share/omarchy/install/`)
- Default configs and migrations
**Size**: ~5-10MB
**Purpose**: Complete self-contained package for ISO - no git clone needed!
### omarchy (future)
**In offline mirror** - Full desktop environment:
- All omarchy-* binaries
- Install scripts and migrations
- Themes and assets
- Heavy dependencies (Hyprland, Waybar, etc.)
**Installed during**: Post-install phase in chroot
## Development Workflow
### Quick Build
```bash
# From omarchy-iso directory (uses default paths)
omarchy-iso-make-dev
# Or with custom paths
export OMARCHY_PKGS_PATH=/path/to/pkgs
export OMARCHY_INSTALLER_PATH=/path/to/installer
omarchy-iso-make-dev
```
This will:
1. Mount omarchy-pkgs into Docker container
2. Mount omarchy-installer (if OMARCHY_INSTALLER_PATH set)
3. Build omarchy-settings from local source
4. Install it in the ISO
5. Create bootable ISO with latest changes
See [ENV_VARS.md](../ENV_VARS.md) for all configuration options.
### Without Package Build
If `omarchy-pkgs` directory is not mounted:
- **Build will fail** with helpful error message
- The ISO build now requires omarchy-settings package
- No fallback to git clone (removed for simplicity)
- Set `OMARCHY_PKGS_PATH` to enable builds
## Directory Structure
```
omarchy-iso/
├── bin/
│ └── omarchy-iso-make # Main entry point (updated to mount omarchy-pkgs)
├── builder/
│ ├── build-iso.sh # Main ISO build (updated for package integration)
│ ├── build-omarchy-packages.sh # New: Local package builder
│ └── README.md # This file
├── configs/
│ ├── profiledef.sh # ISO profile (updated to remove manual file perms)
│ └── ...
└── release/
└── omarchy-*.iso # Built ISOs
```
## How It Works
1. **omarchy-iso-make** detects `../omarchy-pkgs` directory
2. Mounts it read-only into Docker container at `/omarchy-pkgs`
3. **build-iso.sh** checks for `/omarchy-pkgs` mount (REQUIRED!)
4. Sources **build-omarchy-packages.sh** to build package
5. Package is built with makepkg as `nobody` user
6. Built package added to `packages.x86_64` list
7. Copied to offline mirror
8. mkarchiso installs it during ISO assembly
9. ISO boots with omarchy-settings pre-installed
10. **Everything works from package** - no git clone, no manual copying!
## Benefits
### For Development
- ✅ No need to publish packages for testing
- ✅ Instant iteration on configs and binaries
- ✅ Test package integration in real ISO environment
- ✅ Single command builds everything
### For Production
- ✅ Same workflow works with published packages
- ✅ Fallback to manual copying if needed
- ✅ Reproducible builds
- ✅ Version-locked packages
## Troubleshooting
### Package build fails
```bash
# Check that omarchy-pkgs is mounted
docker run --rm -v "$PWD/../omarchy-pkgs:/omarchy-pkgs:ro" archlinux ls -la /omarchy-pkgs
```
### Manual file copying used instead of package
- Ensure omarchy-pkgs directory exists at `../omarchy-pkgs`
- Check Docker mount in omarchy-iso-make
- Look for "Mounting omarchy-pkgs" message during build
### Permission errors
- build-omarchy-packages.sh runs makepkg as `nobody` user
- Temporary sudo access granted for pacman operations
- Cleaned up after build
## Future Enhancements
1. Build full `omarchy` package locally
2. Remove git clone of omarchy-installer entirely
3. Use only packages for all file installation
4. Support building other omarchy-* packages
+68 -19
View File
@@ -30,21 +30,43 @@ rm -rf "$build_cache_dir/airootfs/etc/xdg/reflector"
# Bring in our configs
cp -r /configs/* $build_cache_dir/
# Setup Omarchy itself
if [[ -d /omarchy ]]; then
cp -rp /omarchy "$build_cache_dir/airootfs/root/omarchy"
# Build omarchy-settings package locally
# This package provides EVERYTHING needed for the ISO:
# - User configs (/etc/skel/)
# - System configs (/etc/)
# - Plymouth theme
# - Essential binaries (debug, upload-log)
# - Install scripts (/usr/share/omarchy/install/)
if [ -d "/omarchy-pkgs" ]; then
echo "========================================="
echo "Building omarchy-settings package locally"
echo "========================================="
source /builder/build-omarchy-packages.sh
# Add omarchy packages to ISO
# omarchy-settings provides configs and will be installed in ISO
# omarchy-installer provides install scripts and will be installed in ISO
echo "omarchy-settings" >> "$build_cache_dir/packages.x86_64"
echo "omarchy-installer" >> "$build_cache_dir/packages.x86_64"
# Copy built packages to offline mirror (for installation on target system)
cp "$OMARCHY_SETTINGS_PKG" "$offline_mirror_dir/"
cp "$OMARCHY_INSTALLER_PKG" "$offline_mirror_dir/"
cp "$OMARCHY_PKG" "$offline_mirror_dir/"
cp "$OMARCHY_LIMINE_PKG" "$offline_mirror_dir/"
echo "✓ omarchy-settings will be installed in ISO (configs, binaries)"
echo "✓ omarchy-installer will be installed in ISO (install scripts, helpers)"
echo "✓ omarchy-limine available in offline mirror for installation"
echo "✓ All omarchy packages available in offline mirror for installation"
echo "✓ No git clone needed - everything comes from packages!"
else
git clone -b $OMARCHY_INSTALLER_REF https://github.com/$OMARCHY_INSTALLER_REPO.git "$build_cache_dir/airootfs/root/omarchy"
echo "ERROR: /omarchy-pkgs not mounted!"
echo "The ISO build now requires omarchy-settings package."
echo "Please set OMARCHY_PKGS_PATH or ensure ../omarchy-pkgs exists."
exit 1
fi
# Make log uploader available in the ISO too
mkdir -p "$build_cache_dir/airootfs/usr/local/bin/"
cp "$build_cache_dir/airootfs/root/omarchy/bin/omarchy-upload-log" "$build_cache_dir/airootfs/usr/local/bin/omarchy-upload-log"
# Copy the Omarchy Plymouth theme to the ISO
mkdir -p "$build_cache_dir/airootfs/usr/share/plymouth/themes/omarchy"
cp -r "$build_cache_dir/airootfs/root/omarchy/default/plymouth/"* "$build_cache_dir/airootfs/usr/share/plymouth/themes/omarchy/"
# Download and verify Node.js binary for offline installation
NODE_DIST_URL="https://nodejs.org/dist/latest"
@@ -67,19 +89,41 @@ mkdir -p "$build_cache_dir/airootfs/opt/packages/"
cp "/tmp/$NODE_FILENAME" "$build_cache_dir/airootfs/opt/packages/"
# Add our additional packages to packages.x86_64
arch_packages=(linux-t2 git gum jq openssl plymouth tzupdate omarchy-keyring)
arch_packages=(linux-t2 git gum jq openssl plymouth tzupdate omarchy-keyring python-terminaltexteffects)
printf '%s\n' "${arch_packages[@]}" >>"$build_cache_dir/packages.x86_64"
# Build list of all the packages needed for the offline mirror
all_packages=($(cat "$build_cache_dir/packages.x86_64"))
all_packages+=($(grep -v '^#' "$build_cache_dir/airootfs/root/omarchy/install/omarchy-base.packages" | grep -v '^$'))
all_packages+=($(grep -v '^#' "$build_cache_dir/airootfs/root/omarchy/install/omarchy-other.packages" | grep -v '^$'))
all_packages+=($(grep -v '^#' /builder/archinstall.packages | grep -v '^$'))
# Start with packages.x86_64 but exclude locally-built packages
all_packages=($(cat "$build_cache_dir/packages.x86_64" | grep -vE '^(omarchy|omarchy-settings|omarchy-installer|omarchy-limine)$'))
# Add omarchy package lists from source, excluding locally-built packages
if [ -n "$OMARCHY_INSTALLER_SRC" ] && [ -d "$OMARCHY_INSTALLER_SRC" ]; then
# Filter out locally-built packages and known problematic packages
all_packages+=($(grep -v '^#' "$OMARCHY_INSTALLER_SRC/install/omarchy-base.packages" | grep -v '^$' | grep -vE '^(omarchy|omarchy-settings|omarchy-installer|omarchy-limine)$'))
all_packages+=($(grep -v '^#' "$OMARCHY_INSTALLER_SRC/install/omarchy-other.packages" | grep -v '^$' | grep -vE '^qt5-remoteobjects$'))
else
echo "WARNING: Could not find omarchy package lists, offline mirror may be incomplete"
fi
all_packages+=($(grep -v '^#' /builder/archinstall.packages | grep -v '^$' | grep -vE '^(omarchy|omarchy-settings|omarchy-installer|omarchy-limine)$'))
# Remove duplicates
all_packages=($(printf '%s\n' "${all_packages[@]}" | sort -u))
# Download all the packages to the offline mirror inside the ISO
# Use --needed to skip packages that are already in cache
# Use --noconfirm to avoid interactive prompts
mkdir -p /tmp/offlinedb
pacman --config /configs/pacman-online.conf --noconfirm -Syw "${all_packages[@]}" --cachedir $offline_mirror_dir/ --dbpath /tmp/offlinedb
repo-add --new "$offline_mirror_dir/offline.db.tar.gz" "$offline_mirror_dir/"*.pkg.tar.zst
echo "Downloading ${#all_packages[@]} packages to offline mirror..."
pacman --config /configs/pacman-online.conf --noconfirm -Syw "${all_packages[@]}" --cachedir $offline_mirror_dir/ --dbpath /tmp/offlinedb --needed
# Build repository database for the offline mirror
# First, create the database from all downloaded packages
echo "Building offline repository database..."
repo-add "$offline_mirror_dir/offline.db.tar.gz" "$offline_mirror_dir/"*.pkg.tar.zst
# Note: Our locally built packages (omarchy, omarchy-settings) were copied earlier
# and are now included in the repository database
# Create a symlink to the offline mirror instead of duplicating it.
# mkarchiso needs packages at /var/cache/omarchy/mirror/offline in the container,
@@ -91,6 +135,11 @@ ln -s "$offline_mirror_dir" "/var/cache/omarchy/mirror/offline"
# same config when booted
cp $build_cache_dir/pacman.conf "$build_cache_dir/airootfs/etc/pacman.conf"
# Create missing device-mapper udev rules file to silence mkinitcpio warning
# This file was removed in recent device-mapper versions but mkinitcpio still references it
mkdir -p /usr/lib/initcpio/udev
touch /usr/lib/initcpio/udev/11-dm-initramfs.rules
# Finally, we assemble the entire ISO
mkarchiso -v -w "$build_cache_dir/work/" -o "/out/" "$build_cache_dir/"
+219
View File
@@ -0,0 +1,219 @@
#!/bin/bash
# Build omarchy packages locally for ISO integration
# This runs inside the Docker container during ISO build
set -e
echo "========================================="
echo "Building omarchy-settings package locally"
echo "========================================="
# Packages will be built in /tmp/omarchy-pkg-build
BUILD_DIR="/tmp/omarchy-pkg-build"
# Clean old builds to avoid checksum issues
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
# Create a writable build directory
WORK_DIR="/tmp/omarchy-pkg-work"
# Clean old work directory
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
# Copy package files to writable location
echo "Setting up build directory..."
cp -r /omarchy-pkgs/pkgbuilds/omarchy-settings "$WORK_DIR/"
cd "$WORK_DIR/omarchy-settings"
# Set PKGDEST to control where built packages go
export PKGDEST="$BUILD_DIR"
# Check if we should use dev build (local source)
if [ -n "$OMARCHY_DEV_BUILD" ] && [ -d "/omarchy-installer" ]; then
echo "========================================="
echo "DEV MODE: Using locally mounted source"
echo "========================================="
# Source the dev PKGBUILD patch
source /builder/templates/dev-pkgbuild-patch.sh
convert_to_dev_pkgbuild "PKGBUILD"
BUILD_FILE="PKGBUILD.dev"
BUILD_FLAGS="--noconfirm --skippgpcheck --skipchecksums -f"
echo "✓ Will build from local source (no git clone)"
else
echo "========================================="
echo "PRODUCTION MODE: Using git source"
echo "========================================="
BUILD_FILE="PKGBUILD"
BUILD_FLAGS="--noconfirm --skippgpcheck"
echo "✓ Will git clone from repository"
fi
# Sync package databases (needed for dependency resolution)
echo "Syncing package databases..."
pacman -Sy --noconfirm
# Build the package
# Note: The container runs as root, but makepkg refuses to run as root
# Create a fresh build user (nobody account is expired in base image)
if ! id builder &>/dev/null; then
useradd -m -s /bin/bash builder
fi
# Give builder ownership
chown -R builder:builder "$WORK_DIR/omarchy-settings"
chown -R builder:builder "$BUILD_DIR"
# Allow builder to run pacman without password (needed for dependency installation)
echo "builder ALL=(ALL) NOPASSWD: /usr/bin/pacman" > /etc/sudoers.d/99-builder-pacman
chmod 440 /etc/sudoers.d/99-builder-pacman
# Build the package as builder user (makepkg will install dependencies via sudo)
su builder -c "cd $WORK_DIR/omarchy-settings && makepkg -p $BUILD_FILE $BUILD_FLAGS -s"
# Find the built package
BUILT_PACKAGE=$(ls -t "$BUILD_DIR"/omarchy-settings-*.pkg.tar.zst 2>/dev/null | head -n1)
if [ -z "$BUILT_PACKAGE" ]; then
echo "ERROR: Failed to build omarchy-settings package"
exit 1
fi
echo "✓ Successfully built: $(basename $BUILT_PACKAGE)"
echo "Package location: $BUILT_PACKAGE"
# Export the path for use by build-iso.sh
export OMARCHY_SETTINGS_PKG="$BUILT_PACKAGE"
# Export the source directory for accessing package lists before package is installed
# Check both possible locations (dev mode uses /omarchy-installer, prod uses src/)
if [ -d "/omarchy-installer" ]; then
export OMARCHY_INSTALLER_SRC="/omarchy-installer"
echo "✓ Package source available at: $OMARCHY_INSTALLER_SRC (mounted)"
elif [ -d "$WORK_DIR/omarchy-settings/src/omarchy-installer" ]; then
export OMARCHY_INSTALLER_SRC="$WORK_DIR/omarchy-settings/src/omarchy-installer"
echo "✓ Package source available at: $OMARCHY_INSTALLER_SRC (from build)"
fi
echo "✓ Package contains everything needed for ISO (configs, package lists, binaries, theme)"
# Now build the omarchy-installer package
echo ""
echo "========================================="
echo "Building omarchy-installer package"
echo "========================================="
# Copy omarchy-installer package files to writable location
cp -r /omarchy-pkgs/pkgbuilds/omarchy-installer "$WORK_DIR/"
cd "$WORK_DIR/omarchy-installer"
# Check if we should use dev build
if [ -n "$OMARCHY_DEV_BUILD" ] && [ -d "/omarchy-installer" ]; then
echo "DEV MODE: Using locally mounted source"
# Generate dev PKGBUILD
source /builder/templates/dev-pkgbuild-patch.sh
convert_to_dev_pkgbuild "PKGBUILD"
INSTALLER_BUILD_FILE="PKGBUILD.dev"
INSTALLER_BUILD_FLAGS="--noconfirm --skippgpcheck --skipchecksums -f"
else
echo "PRODUCTION MODE: Using git source"
INSTALLER_BUILD_FILE="PKGBUILD"
INSTALLER_BUILD_FLAGS="--noconfirm --skippgpcheck"
fi
# Give builder ownership
chown -R builder:builder "$WORK_DIR/omarchy-installer"
# Build the omarchy-installer package
su builder -c "cd $WORK_DIR/omarchy-installer && makepkg -p $INSTALLER_BUILD_FILE $INSTALLER_BUILD_FLAGS -d"
# Find the built package
OMARCHY_INSTALLER_PKG=$(ls -t "$BUILD_DIR"/omarchy-installer-*.pkg.tar.zst 2>/dev/null | head -n1)
if [ -z "$OMARCHY_INSTALLER_PKG" ]; then
echo "ERROR: Failed to build omarchy-installer package"
exit 1
fi
echo "✓ Successfully built: $(basename $OMARCHY_INSTALLER_PKG)"
echo "Package location: $OMARCHY_INSTALLER_PKG"
# Now build the full omarchy package for offline mirror
echo ""
echo "========================================="
echo "Building omarchy meta-package"
echo "========================================="
# Copy omarchy package files to writable location
cp -r /omarchy-pkgs/pkgbuilds/omarchy "$WORK_DIR/"
cd "$WORK_DIR/omarchy"
# Check if we should use dev build
if [ -n "$OMARCHY_DEV_BUILD" ] && [ -d "/omarchy-installer" ]; then
echo "DEV MODE: Using locally mounted source"
# Generate dev PKGBUILD
source /builder/templates/dev-pkgbuild-patch.sh
convert_to_dev_pkgbuild "PKGBUILD"
OMARCHY_BUILD_FILE="PKGBUILD.dev"
OMARCHY_BUILD_FLAGS="--noconfirm --skippgpcheck --skipchecksums -f"
else
echo "PRODUCTION MODE: Using git source"
OMARCHY_BUILD_FILE="PKGBUILD"
OMARCHY_BUILD_FLAGS="--noconfirm --skippgpcheck"
fi
# Give builder ownership
chown -R builder:builder "$WORK_DIR/omarchy"
# Build the omarchy package
# Note: Skip dependency checks (-d) since we're just packaging files, not running them
# The dependencies will be resolved when the package is installed in the actual system
su builder -c "cd $WORK_DIR/omarchy && makepkg -p $OMARCHY_BUILD_FILE $OMARCHY_BUILD_FLAGS -d"
# Find the built package
OMARCHY_PKG=$(ls -t "$BUILD_DIR"/omarchy-*.pkg.tar.zst 2>/dev/null | head -n1)
if [ -z "$OMARCHY_PKG" ]; then
echo "ERROR: Failed to build omarchy package"
exit 1
fi
echo "✓ Successfully built: $(basename $OMARCHY_PKG)"
echo "Package location: $OMARCHY_PKG"
# Now build the omarchy-limine package
echo ""
echo "========================================="
echo "Building omarchy-limine package"
echo "========================================="
# Copy omarchy-limine package files to writable location
cp -r /omarchy-pkgs/pkgbuilds/omarchy-limine "$WORK_DIR/"
cd "$WORK_DIR/omarchy-limine"
# Give builder ownership
chown -R builder:builder "$WORK_DIR/omarchy-limine"
# Build the omarchy-limine package (no source needed, just config files)
su builder -c "cd $WORK_DIR/omarchy-limine && makepkg --noconfirm --skippgpcheck -d"
# Find the built package
OMARCHY_LIMINE_PKG=$(ls -t "$BUILD_DIR"/omarchy-limine-*.pkg.tar.zst 2>/dev/null | head -n1)
if [ -z "$OMARCHY_LIMINE_PKG" ]; then
echo "ERROR: Failed to build omarchy-limine package"
exit 1
fi
echo "✓ Successfully built: $(basename $OMARCHY_LIMINE_PKG)"
echo "Package location: $OMARCHY_LIMINE_PKG"
# Export for use by build-iso.sh
export OMARCHY_PKG="$OMARCHY_PKG"
export OMARCHY_INSTALLER_PKG="$OMARCHY_INSTALLER_PKG"
export OMARCHY_LIMINE_PKG="$OMARCHY_LIMINE_PKG"
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Patch to convert production PKGBUILD to dev PKGBUILD
# This script modifies PKGBUILD to use local source instead of git clone
convert_to_dev_pkgbuild() {
local pkgbuild_path="$1"
local dev_pkgbuild_path="${pkgbuild_path}.dev"
echo "Creating dev PKGBUILD from production version..."
# Copy production PKGBUILD
cp "$pkgbuild_path" "$dev_pkgbuild_path"
# Remove git source (replace with empty source array)
sed -i '/^source=/c\source=()' "$dev_pkgbuild_path"
sed -i '/^sha256sums=/c\sha256sums=()' "$dev_pkgbuild_path"
# Replace cd "omarchy-installer" with cd "/omarchy-installer" to use mounted directory directly
sed -i 's|cd "omarchy-installer"|cd "/omarchy-installer"|g' "$dev_pkgbuild_path"
echo "✓ Dev PKGBUILD created: $dev_pkgbuild_path"
echo "✓ Will use /omarchy-installer directly (no git clone, no symlinks)"
}
+1 -1
View File
@@ -1,3 +1,3 @@
[Daemon]
Theme=omarchy
ShowDelay=0
ShowDelay=0
+127 -86
View File
@@ -2,40 +2,147 @@
set -euo pipefail
use_omarchy_helpers() {
export OMARCHY_PATH="/root/omarchy"
export OMARCHY_INSTALL="/root/omarchy/install"
export OMARCHY_INSTALL_LOG_FILE="/var/log/omarchy-install.log"
source /root/omarchy/install/helpers/all.sh
# Use omarchy-settings package location (installed in ISO)
export OMARCHY_PATH="/usr/share/omarchy"
export OMARCHY_INSTALL="/usr/share/omarchy/install"
export OMARCHY_INSTALL_LOG_FILE="/var/log/archinstall/install.log"
# Load presentation helpers (clear_logo, etc.) and logging helpers (start_log_output, etc.)
source /usr/share/omarchy/install/helpers/all.sh
}
run_configurator() {
set_tokyo_night_colors
./configurator
export OMARCHY_USER="$(jq -r '.users[0].username' user_credentials.json)"
export OMARCHY_USER="$(jq -r '.username' user_info.json)"
export OMARCHY_USER_PASSWORD_HASH="$(jq -r '.password_hash' user_info.json)"
export OMARCHY_USER_NAME="$(cat user_full_name.txt)"
export OMARCHY_USER_EMAIL="$(cat user_email_address.txt)"
}
install_arch() {
install_omarchy() {
clear_logo
gum style --foreground 3 --padding "1 0 0 $PADDING_LEFT" "Installing..."
echo
# Copy user info to /tmp on the ISO side
# omarchy-install will copy these into the chroot at the right time
cp user_full_name.txt /tmp/omarchy-user-name.txt 2>/dev/null || true
cp user_email_address.txt /tmp/omarchy-user-email.txt 2>/dev/null || true
# Check if advanced disk mode (partition TUI)
EDIT_PARTITIONS_FLAG=""
if [[ -f edit_partitions_flag.txt ]]; then
EDIT_PARTITIONS_FLAG=$(cat edit_partitions_flag.txt | tr -d '\n' | xargs)
fi
# ADVANCED MODE: Run disk configuration TUI before installation
if [[ -n "$EDIT_PARTITIONS_FLAG" ]]; then
clear_logo
gum style --foreground 3 --padding "1 0 0 $PADDING_LEFT" "Configuring disk layout..."
echo
# Run omarchy-disk-config to show partition TUI and validate
# This updates user_configuration.json in place
/usr/share/omarchy/bin/omarchy-disk-config \
--config user_configuration.json \
--creds user_credentials.json
disk_config_exit_code=$?
if [[ $disk_config_exit_code -ne 0 ]]; then
echo "ERROR: Disk configuration failed or was cancelled"
exit $disk_config_exit_code
fi
clear_logo
gum style --foreground 3 --padding "1 0 0 $PADDING_LEFT" "Disk configuration complete!"
echo
sleep 1
fi
# Run installation with the configuration (possibly updated by disk-config)
# Create backup log file for raw output (with ANSI codes stripped)
touch /var/log/omarchy-install.log
# Ensure archinstall log directory exists
sudo mkdir -p /var/log/archinstall
# Prepare chroot log location (will be created by chroot script when it runs)
sudo mkdir -p /mnt/var/log
CHROOT_LOG="/mnt/var/log/omarchy-install-chroot.log"
# Start tailing BOTH logs with tail -F (follows multiple files, waits for files to appear)
# This will automatically pick up the chroot log when it's created
start_log_output "/var/log/omarchy-install.log" "$CHROOT_LOG"
# Run omarchy-install and capture output
# archinstall writes to /var/log/archinstall/install.log internally
# We also capture stdout/stderr to our backup log (stripping ANSI codes for clean viewing)
/usr/share/omarchy/bin/omarchy-install \
--config user_configuration.json \
--creds user_credentials.json \
2>&1 | sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' | tee -a /var/log/omarchy-install.log >/dev/null
install_exit_code=$?
# Check if omarchy-install failed
if [[ $install_exit_code -ne 0 ]]; then
stop_log_output
echo
echo "ERROR: Installation failed (exit code $install_exit_code)"
echo "Check /var/log/omarchy-install.log and /mnt/var/log/omarchy-install-chroot.log for details"
exit $install_exit_code
fi
start_log_output
# Set CURRENT_SCRIPT for the trap to display better when nothing is returned for some reason
CURRENT_SCRIPT="install_base_system"
install_base_system > >(sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' >>/var/log/omarchy-install.log) 2>&1
unset CURRENT_SCRIPT
# Installation succeeded - stop log output BEFORE doing anything else
stop_log_output
}
install_omarchy() {
chroot_bash -lc "sudo pacman -S --noconfirm --needed gum" >/dev/null
chroot_bash -lc "source /home/$OMARCHY_USER/.local/share/omarchy/install.sh || bash"
# Reboot if requested by installer
if [[ -f /mnt/var/tmp/omarchy-install-completed ]]; then
# Copy and merge logs to installed system for user access (silent)
{
sudo cp /var/log/omarchy-install.log /mnt/var/log/omarchy-install.log 2>/dev/null || true
sudo cp /var/log/archinstall/install.log /mnt/var/log/archinstall-install.log 2>/dev/null || true
# Create a merged log with all phases
{
echo "========================================"
echo "Omarchy Installation - Complete Log"
echo "Generated: $(date '+%Y-%m-%d %H:%M:%S')"
echo "========================================"
echo
echo "=== Phase 1: Main Installation (ISO) ==="
cat /var/log/omarchy-install.log 2>/dev/null || echo "(No main install log found)"
echo
echo "=== Phase 2: Chroot Configuration ==="
cat "$CHROOT_LOG" 2>/dev/null || echo "(No chroot log found)"
echo
echo "========================================"
echo "Installation Complete"
echo "========================================"
} | sudo tee /mnt/var/log/omarchy-install-full.log >/dev/null
} >/dev/null 2>&1
# Show completion screen
clear
echo
tte -i /usr/share/omarchy/logo.txt --canvas-width 0 --anchor-text c --frame-rate 920 laseretch
echo
# Display installation time if available
if [[ -f /mnt/tmp/omarchy-install-time.txt ]]; then
TOTAL_TIME=$(cat /mnt/tmp/omarchy-install-time.txt)
echo "Installed in $TOTAL_TIME" | tte --canvas-width 0 --anchor-text c --frame-rate 640 print
else
echo "Finished installing" | tte --canvas-width 0 --anchor-text c --frame-rate 640 print
fi
echo
# Prompt for reboot (centered)
BUTTON_WIDTH=12 # "Reboot Now" + padding
BUTTON_PADDING=$(( (TERM_WIDTH - BUTTON_WIDTH) / 2 ))
if gum confirm --padding "0 0 0 $BUTTON_PADDING" --show-help=false --default --affirmative "Reboot Now" --negative "" ""; then
clear
reboot
fi
}
@@ -67,74 +174,8 @@ set_tokyo_night_colors() {
fi
}
install_base_system() {
# Initialize and populate the keyring
pacman-key --init
pacman-key --populate archlinux
pacman-key --populate omarchy
# Sync the offline database so pacman can find packages
pacman -Sy --noconfirm
# Ensure that no mounts exist from past install attempts
findmnt -R /mnt >/dev/null && umount -R /mnt
# Install using files generated by the ./configurator
# Skip NTP and WKD sync since we're offline (keyring is pre-populated in ISO)
archinstall \
--config user_configuration.json \
--creds user_credentials.json \
--silent \
--skip-ntp \
--skip-wkd
# After archinstall sets up the base system but before our installer runs,
# we need to ensure the offline pacman.conf is in place
cp /etc/pacman.conf /mnt/etc/pacman.conf
# Mount the offline mirror so it's accessible in the chroot
mkdir -p /mnt/var/cache/omarchy/mirror/offline
mount --bind /var/cache/omarchy/mirror/offline /mnt/var/cache/omarchy/mirror/offline
# Mount the packages dir so it's accessible in the chroot
mkdir -p /mnt/opt/packages
mount --bind /opt/packages /mnt/opt/packages
# No need to ask for sudo during the installation (omarchy itself responsible for removing after install)
mkdir -p /mnt/etc/sudoers.d
cat >/mnt/etc/sudoers.d/99-omarchy-installer <<EOF
root ALL=(ALL:ALL) NOPASSWD: ALL
%wheel ALL=(ALL:ALL) NOPASSWD: ALL
$OMARCHY_USER ALL=(ALL:ALL) NOPASSWD: ALL
EOF
chmod 440 /mnt/etc/sudoers.d/99-omarchy-installer
# Copy the local omarchy repo to the user's home directory
mkdir -p /mnt/home/$OMARCHY_USER/.local/share/
cp -r /root/omarchy /mnt/home/$OMARCHY_USER/.local/share/
chown -R 1000:1000 /mnt/home/$OMARCHY_USER/.local/
# Ensure all necessary scripts are executable
find /mnt/home/$OMARCHY_USER/.local/share/omarchy -type f -path "*/bin/*" -exec chmod +x {} \;
chmod +x /mnt/home/$OMARCHY_USER/.local/share/omarchy/boot.sh 2>/dev/null || true
chmod +x /mnt/home/$OMARCHY_USER/.local/share/omarchy/default/waybar/indicators/screen-recording.sh 2>/dev/null || true
}
chroot_bash() {
HOME=/home/$OMARCHY_USER \
arch-chroot -u $OMARCHY_USER /mnt/ \
env OMARCHY_CHROOT_INSTALL=1 \
OMARCHY_USER_NAME="$(<user_full_name.txt)" \
OMARCHY_USER_EMAIL="$(<user_email_address.txt)" \
USER="$OMARCHY_USER" \
HOME="/home/$OMARCHY_USER" \
/bin/bash "$@"
}
if [[ $(tty) == "/dev/tty1" ]]; then
use_omarchy_helpers
run_configurator
install_arch
install_omarchy
fi
+145 -32
View File
@@ -6,6 +6,27 @@ source "$OMARCHY_INSTALL/helpers/all.sh"
# Ensure tzupdate is available for guessing timezone
command -v tzupdate >/dev/null || sudo pacman -Sy --noconfirm tzupdate
# Build the package list for archinstall from omarchy-base.packages
build_package_json() {
local packages=("base-devel" "git" "omarchy-keyring" "omarchy-settings")
# Read omarchy-base.packages and add to array
while IFS= read -r pkg; do
[[ -z "$pkg" || "$pkg" =~ ^# ]] && continue
packages+=("$pkg")
done < "$OMARCHY_INSTALL/omarchy-base.packages"
# Format as JSON array
local json="["
for i in "${!packages[@]}"; do
json+="\"${packages[$i]}\""
[[ $i -lt $((${#packages[@]} - 1)) ]] && json+=", "
done
json+="]"
echo "$json"
}
abort() {
gum style "${1:-Aborted installation}"
echo
@@ -214,23 +235,54 @@ disk_form() {
disk_options="$disk_options$disk_info"$'\n'
fi
done <<<"$available_disks"
# Add "Advanced Disk Config" option at the bottom
disk_options="${disk_options}Advanced Disk Config (custom partitioning)"
selected_display=$(echo "$disk_options" | gum choose --header "Select install disk") || abort
disk=$(echo "$selected_display" | awk '{print $1}')
# Check if user selected advanced config
if echo "$selected_display" | grep -q "Advanced Disk Config"; then
USE_ADVANCED_DISK_CONFIG=1
EDIT_PARTITIONS="--edit-partitions"
disk="" # Will be determined by TUI
else
USE_ADVANCED_DISK_CONFIG=0
disk=$(echo "$selected_display" | awk '{print $1}')
fi
}
disk_form
while true; do
gum style "Everything will be overwritten. There is no recovery possible."
# If user selected advanced config, skip to partition editor
if [[ $USE_ADVANCED_DISK_CONFIG -eq 1 ]]; then
gum style --foreground 3 "Advanced disk configuration selected."
gum style "You'll configure partitions in the archinstall TUI."
echo
if gum confirm --affirmative "Yes, format disk" --negative "No, change it" "Confirm overwriting ${disk}"; then
break
else
disk_form
fi
done
EDIT_PARTITIONS="--edit-partitions"
else
# Normal flow: confirm disk wipe and use default layout
while true; do
gum style "Everything will be overwritten. There is no recovery possible."
echo
if gum confirm --affirmative "Yes, format disk" --negative "No, change it" "Confirm overwriting ${disk}"; then
break
else
disk_form
# Check again if user switched to advanced config
if [[ $USE_ADVANCED_DISK_CONFIG -eq 1 ]]; then
gum style --foreground 3 "Advanced disk configuration selected."
gum style "You'll configure partitions in the archinstall TUI."
echo
EDIT_PARTITIONS="--edit-partitions"
break
fi
fi
done
# Normal flow always uses default layout (no editing)
EDIT_PARTITIONS=""
fi
clear
@@ -239,6 +291,9 @@ clear
echo "$full_name" >user_full_name.txt
echo "$email_address" >user_email_address.txt
# Save partition editing preference
echo "$EDIT_PARTITIONS" >edit_partitions_flag.txt
# Escape username and password for safe inclusion
password_escaped=$(echo -n "$password" | jq -Rsa)
password_hash_escaped=$(echo -n "$password_hash" | jq -Rsa)
@@ -250,27 +305,36 @@ cat <<-_EOF_ >user_credentials.json
"root_enc_password": $password_hash_escaped,
"users": [
{
"username": $username_escaped,
"enc_password": $password_hash_escaped,
"groups": [],
"sudo": true,
"username": $username_escaped
"sudo": true
}
]
}
_EOF_
# Setup partition layout
disk_size=$(lsblk -bdno SIZE "$disk")
mib=$((1024 * 1024))
gib=$((mib * 1024))
disk_size_in_mib=$((disk_size / mib * mib)) # Rounds to nearest MiB
# Save user info separately so we can create the user after packages are installed
cat <<-_EOF_ >user_info.json
{
"username": $username_escaped,
"password_hash": $password_hash_escaped
}
_EOF_
gpt_backup_reserve=$((mib))
boot_partition_start=$((mib))
boot_partition_size=$((2 * gib))
# Setup partition layout (only for non-advanced config)
if [[ $USE_ADVANCED_DISK_CONFIG -eq 0 ]]; then
disk_size=$(lsblk -bdno SIZE "$disk")
mib=$((1024 * 1024))
gib=$((mib * 1024))
disk_size_in_mib=$((disk_size / mib * mib)) # Rounds to nearest MiB
main_partition_start=$((boot_partition_size + boot_partition_start))
main_partition_size=$((disk_size_in_mib - main_partition_start - gpt_backup_reserve))
gpt_backup_reserve=$((mib))
boot_partition_start=$((mib))
boot_partition_size=$((2 * gib))
main_partition_start=$((boot_partition_size + boot_partition_start))
main_partition_size=$((disk_size_in_mib - main_partition_start - gpt_backup_reserve))
fi
# Detect T2 Mac and set appropriate kernel
if lspci -nn 2>/dev/null | grep -q "106b:180[12]"; then
@@ -279,14 +343,67 @@ else
kernel_choice="linux"
fi
cat <<-_EOF_ >user_configuration.json
# Build the complete package list including all Omarchy packages
packages_json=$(build_package_json)
# Generate configuration based on mode
if [[ $USE_ADVANCED_DISK_CONFIG -eq 1 ]]; then
# Minimal config for advanced mode - user will configure disk in TUI
cat <<-_EOF_ >user_configuration.json
{
"app_config": null,
"archinstall-language": "English",
"auth_config": {},
"audio_config": { "audio": "pipewire" },
"bootloader": "Limine",
"custom_commands": [],
"custom_commands": [
"/usr/share/omarchy/bin/omarchy-install-final-configurations.sh"
],
"hostname": "$hostname",
"kernels": [ "$kernel_choice" ],
"network_config": { "type": "iso" },
"ntp": true,
"parallel_downloads": 8,
"script": null,
"services": [],
"swap": true,
"timezone": "$timezone",
"locale_config": {
"kb_layout": "$keyboard",
"sys_enc": "UTF-8",
"sys_lang": "en_US.UTF-8"
},
"mirror_config": {
"custom_repositories": [],
"custom_servers": [
{"url": "https://mirror.omarchy.org/\$repo/os/\$arch"},
{"url": "https://mirror.rackspace.com/archlinux/\$repo/os/\$arch"},
{"url": "https://geo.mirror.pkgbuild.com/\$repo/os/\$arch"}
],
"mirror_regions": {},
"optional_repositories": []
},
"packages": $packages_json,
"profile_config": {
"gfx_driver": null,
"greeter": null,
"profile": {}
},
"version": "3.0.9"
}
_EOF_
else
# Full config with default partition layout
cat <<-_EOF_ >user_configuration.json
{
"app_config": null,
"archinstall-language": "English",
"auth_config": {},
"audio_config": { "audio": "pipewire" },
"bootloader": "Limine",
"custom_commands": [
"/usr/share/omarchy/bin/omarchy-install-final-configurations.sh"
],
"disk_config": {
"btrfs_options": {
"snapshot_config": {
@@ -353,8 +470,7 @@ cat <<-_EOF_ >user_configuration.json
"encryption_type": "luks",
"lvm_volumes": [],
"iter_time": 2000,
"partitions": [ "8c2c2b92-1070-455d-b76a-56263bab24aa" ],
"encryption_password": $password_escaped
"partitions": [ "8c2c2b92-1070-455d-b76a-56263bab24aa" ]
}
},
"hostname": "$hostname",
@@ -381,11 +497,7 @@ cat <<-_EOF_ >user_configuration.json
"mirror_regions": {},
"optional_repositories": []
},
"packages": [
"base-devel",
"git",
"omarchy-keyring"
],
"packages": $packages_json,
"profile_config": {
"gfx_driver": null,
"greeter": null,
@@ -394,6 +506,7 @@ cat <<-_EOF_ >user_configuration.json
"version": "3.0.9"
}
_EOF_
fi
if [[ $1 == "dry" ]]; then
echo -e "User Configuration:"
-1
View File
@@ -22,5 +22,4 @@ file_permissions=(
["/usr/local/bin/choose-mirror"]="0:0:755"
["/root/configurator"]="0:0:755"
["/var/cache/omarchy/mirror/offline/"]="0:0:775"
["/usr/local/bin/omarchy-upload-log"]="0:0:755"
)