Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions bin/omarchy-iso-make
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ OMARCHY_INSTALLER_REF="${OMARCHY_INSTALLER_REF:-master}"
OMARCHY_MIRROR="${OMARCHY_MIRROR:-stable}"

DOCKER_ARGS=(
--rm
--privileged
-e "OMARCHY_INSTALLER_REPO=$OMARCHY_INSTALLER_REPO"
-e "OMARCHY_INSTALLER_REF=$OMARCHY_INSTALLER_REF"
Expand All @@ -75,16 +74,36 @@ fi

# Mount the build cache directory where packages are downloaded
if [[ -z "$NO_CACHE" ]]; then
# using a dated dir on the host to refresh daily if building multiple times
BUILD_DATE=$(date +%Y-%m-%d)
OFFLINE_REPO_BUILD_CACHE_DIR="$HOME/.cache/omarchy/iso_${BUILD_DATE}/airootfs/var/cache/omarchy"
# Using a 24-hour window cache (not daily) to handle rapid Arch package updates
# Cache is valid for 24 hours from first build, then refreshes
# Format: YYYYMMDD_HH (e.g., 20260111_14 for Jan 11, 2026 at 14:00)
BUILD_TIMESTAMP=$(date +%Y%m%d_%H)
OFFLINE_REPO_BUILD_CACHE_DIR="$HOME/.cache/omarchy/iso_${BUILD_TIMESTAMP}/airootfs/var/cache/omarchy"
mkdir -p "$OFFLINE_REPO_BUILD_CACHE_DIR"
# Mount to /var/cache/airootfs/var/cache/omarchy since that's where repo packages go in the ISO
DOCKER_ARGS+=(-v "$OFFLINE_REPO_BUILD_CACHE_DIR:/var/cache/airootfs/var/cache/omarchy")
fi

# Clean up any existing omarchy-iso build containers (but not other containers)
# Use a specific container name to avoid touching other containers
OMARCHY_BUILD_CONTAINER_NAME="omarchy-iso-build-$(id -u)"
if docker ps -a --format '{{.Names}}' 2>/dev/null | grep -q "^${OMARCHY_BUILD_CONTAINER_NAME}$"; then
echo "Cleaning up previous omarchy-iso build container: ${OMARCHY_BUILD_CONTAINER_NAME}"
docker rm -f "${OMARCHY_BUILD_CONTAINER_NAME}" 2>/dev/null || true
fi

# Run the builder with assembled args
docker run "${DOCKER_ARGS[@]}" archlinux/archlinux:latest /$BUILD_SCRIPT
# Use --name to create a named container for easy cleanup
# Note: --rm is removed from DOCKER_ARGS since we're using a named container
DOCKER_ARGS_NO_RM=()
for arg in "${DOCKER_ARGS[@]}"; do
[[ "$arg" != "--rm" ]] && DOCKER_ARGS_NO_RM+=("$arg")
done

docker run --name "${OMARCHY_BUILD_CONTAINER_NAME}" "${DOCKER_ARGS_NO_RM[@]}" archlinux/archlinux:latest /$BUILD_SCRIPT

# Clean up the container after build completes
docker rm "${OMARCHY_BUILD_CONTAINER_NAME}" 2>/dev/null || true

# Move as install ref
latest_iso=$(\ls -t "$BUILD_RELEASE_PATH"/*.iso | head -n1)
Expand Down
66 changes: 66 additions & 0 deletions bin/omarchy-iso-make-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

# Build Omarchy ISO with local source and custom environment variables
# This script sets up the environment and calls omarchy-iso-make
#
# Usage:
# ./bin/omarchy-iso-make-local [additional omarchy-iso-make options]
#
# Environment variables (can be set before running):
# OMARCHY_REPO_PATH - Path to omarchy-repo (default: $HOME/dev/omarchy-libreboot-coreboot/omarchy-repo)
# OMARCHY_SKIP_DETECTION_PAUSE - Set to 1 to skip detection pauses (default: 0 - pauses enabled for screenshots)
#
# Examples:
# ./bin/omarchy-iso-make-local
# ./bin/omarchy-iso-make-local --no-cache
# OMARCHY_REPO_PATH=/path/to/repo ./bin/omarchy-iso-make-local

# Abort if anything fails
set -e

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OMARCHY_ISO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# Set OMARCHY_PATH to the modified repo
# Adjust this path if your omarchy-repo is in a different location
OMARCHY_REPO_PATH="${OMARCHY_REPO_PATH:-$HOME/dev/omarchy-libreboot-coreboot/omarchy-repo}"

# Verify OMARCHY_REPO_PATH exists
if [[ ! -d "$OMARCHY_REPO_PATH" ]]; then
echo "Error: OMARCHY_REPO_PATH not found: $OMARCHY_REPO_PATH" >&2
echo "Set OMARCHY_REPO_PATH environment variable or ensure the path is correct." >&2
echo "" >&2
echo "Example:" >&2
echo " export OMARCHY_REPO_PATH=/path/to/omarchy-repo" >&2
echo " ./bin/omarchy-iso-make-local" >&2
exit 1
fi

# Export environment variables
export OMARCHY_PATH="$OMARCHY_REPO_PATH"
# Default to 0 (pauses enabled) - set to 1 to skip pauses
export OMARCHY_SKIP_DETECTION_PAUSE="${OMARCHY_SKIP_DETECTION_PAUSE:-0}"

# Optional: Set other environment variables if needed (uncomment to use)
# export OMARCHY_INSTALLER_REPO="basecamp/omarchy"
# export OMARCHY_INSTALLER_REF="master"
# export OMARCHY_MIRROR="stable"

# Change to omarchy-iso directory
cd "$OMARCHY_ISO_ROOT"

# Run the build
echo "=========================================="
echo "Building Omarchy ISO with local source"
echo "=========================================="
echo "OMARCHY_PATH: $OMARCHY_PATH"
echo "OMARCHY_SKIP_DETECTION_PAUSE: $OMARCHY_SKIP_DETECTION_PAUSE (0=pauses enabled, 1=skip pauses)"
echo ""
echo "Note: Pauses are ENABLED by default (10 seconds) for screenshots."
echo " Set OMARCHY_SKIP_DETECTION_PAUSE=1 to disable pauses."
echo ""
echo "Passing arguments to omarchy-iso-make: $*"
echo ""

./bin/omarchy-iso-make --local-source "$@"