Skip to content
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.cache
release/**
vm-saves/**
26 changes: 17 additions & 9 deletions bin/omarchy-iso-make
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ OMARCHY_INSTALLER_REF="${OMARCHY_INSTALLER_REF:-master}"
DOCKER_ARGS=(
--rm
--privileged
--platform linux/amd64 # Suppress warnings if building on Apple Silicon
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the annoying message (I'm still building stuff on my Mac)

--ulimit nofile=8192:8192 # Prevent "Too many open files in system" errors during build
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started getting an error "Too many open files in system" during builds, so this fixes that.

-e "OMARCHY_INSTALLER_REPO=$OMARCHY_INSTALLER_REPO"
-e "OMARCHY_INSTALLER_REF=$OMARCHY_INSTALLER_REF"
-e "HOST_UID=$(id -u)"
Expand All @@ -62,19 +64,25 @@ if [[ -n "${LOCAL_SOURCE-}" ]]; then
DOCKER_ARGS+=(-v "$OMARCHY_PATH:/omarchy:ro")
fi

# Use local pacman cache if you already have one on host to speed up repeat runs
if [ -d "/var/cache/pacman/pkg" ]; then
DOCKER_ARGS+=(-v "/var/cache/pacman/pkg:/var/cache/pacman/pkg")
fi

# Mount the build cache directory where packages are downloaded
# Set up host caching unless disabled
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"
OMARCHY_CACHE_DIR="${OMARCHY_CACHE_DIR:-$HOME/.cache/omarchy}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a sensible default location that can be overridden with an env var.


# Use a local pacman cache to speed up repeat runs
DOCKER_ARGS+=(-v "$OMARCHY_CACHE_DIR/pacman:/var/cache/pacman")
mkdir -p "$OMARCHY_CACHE_DIR/pacman"

# Use a dated dir on the host to refresh daily if building multiple times
OFFLINE_REPO_BASE="$OMARCHY_CACHE_DIR/iso"
TODAY=$(date +%Y-%m-%d)
OFFLINE_REPO_BUILD_CACHE_DIR="$OFFLINE_REPO_BASE/$TODAY/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")

# Wipe stale cache folders
find "$OFFLINE_REPO_BASE" -mindepth 1 -maxdepth 1 -type d ! -name "$TODAY" -exec rm -rf {} +
fi

# Run the builder with assembled args
Expand Down