diff --git a/build/Dockerfile b/build/Dockerfile index 4121ce4..745c5c2 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -10,6 +10,7 @@ FROM docker.io/alpine:3.21 AS bootstrapper ARG TARGETARCH ARG BUILDPLATFORM +ARG MIRROR=edge COPY pacstrap-docker /usr/local/bin/ @@ -36,7 +37,12 @@ RUN mkdir -p /etc/pacman.d && \ cat /tmp/repos.conf >> /etc/pacman.conf RUN if [ "${TARGETARCH}" = "amd64" ]; then \ - printf 'Server = https://mirror.omarchy.org/$repo/os/$arch\nServer = https://mirror.rackspace.com/archlinux/$repo/os/$arch\nServer = https://geo.mirror.pkgbuild.com/$repo/os/$arch\n' > /etc/pacman.d/mirrorlist; \ + if [ "${MIRROR}" = "stable" ]; then \ + OMARCHY_MIRROR="https://stable-mirror.omarchy.org"; \ + else \ + OMARCHY_MIRROR="https://mirror.omarchy.org"; \ + fi && \ + printf "Server = ${OMARCHY_MIRROR}/"'$repo/os/$arch\n' > /etc/pacman.d/mirrorlist; \ else \ curl -L "https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/core/pacman-mirrorlist/mirrorlist" 2>/dev/null | \ sed -E 's/^\s*#\s*Server\s*=/Server =/g' > /etc/pacman.d/mirrorlist && \ diff --git a/build/build.sh b/build/build.sh index ec0f793..029dd1a 100755 --- a/build/build.sh +++ b/build/build.sh @@ -6,8 +6,9 @@ # Setup directories ARCH=${ARCH:-x86_64} -BUILD_OUTPUT_DIR="/build-output/$ARCH" -FINAL_OUTPUT_DIR="/pkgs.omarchy.org/$ARCH" +MIRROR=${MIRROR:-edge} +BUILD_OUTPUT_DIR="/build-output/$MIRROR/$ARCH" +FINAL_OUTPUT_DIR="/pkgs.omarchy.org/$MIRROR/$ARCH" mkdir -p "$BUILD_OUTPUT_DIR" "$FINAL_OUTPUT_DIR" @@ -55,6 +56,7 @@ sudo pacman -Sy echo "==> Package Builder" echo "==> Target architecture: $ARCH" +echo "==> Mirror: $MIRROR" echo "==> Build workspace: $BUILD_OUTPUT_DIR" echo "==> Final output: $FINAL_OUTPUT_DIR" diff --git a/build/remove-package.sh b/build/remove-package.sh index b79adba..da6b364 100755 --- a/build/remove-package.sh +++ b/build/remove-package.sh @@ -4,8 +4,9 @@ set -e ARCH=${ARCH:-x86_64} +MIRROR=${MIRROR:-edge} PACKAGE_NAME="$1" -REPO_DIR="/pkgs.omarchy.org/$ARCH" +REPO_DIR="/pkgs.omarchy.org/$MIRROR/$ARCH" if [[ -z "$PACKAGE_NAME" ]]; then echo "ERROR: Package name required" diff --git a/build/sign.sh b/build/sign.sh index a05c79e..022b19e 100755 --- a/build/sign.sh +++ b/build/sign.sh @@ -4,10 +4,12 @@ set -e ARCH=${ARCH:-x86_64} -BUILD_OUTPUT_DIR="/build-output/$ARCH" +MIRROR=${MIRROR:-edge} +BUILD_OUTPUT_DIR="/build-output/$MIRROR/$ARCH" echo "==> Package Signing" echo "==> Target architecture: $ARCH" +echo "==> Mirror: $MIRROR" echo "==> Build output: $BUILD_OUTPUT_DIR" # Check if GPG key and passphrase are provided diff --git a/build/update-repo.sh b/build/update-repo.sh index 159c216..b8f3d78 100755 --- a/build/update-repo.sh +++ b/build/update-repo.sh @@ -4,7 +4,8 @@ set -e ARCH=${ARCH:-x86_64} -OUTPUT_DIR="/output/$ARCH" +MIRROR=${MIRROR:-edge} +OUTPUT_DIR="/output/$MIRROR/$ARCH" REPO_NAME="omarchy" DB_FILE="$OUTPUT_DIR/${REPO_NAME}.db.tar.zst" diff --git a/helpers/docker-helpers.sh b/helpers/docker-helpers.sh index e40c54d..3b1b5c0 100644 --- a/helpers/docker-helpers.sh +++ b/helpers/docker-helpers.sh @@ -25,8 +25,9 @@ setup_qemu() { build_docker_image() { local build_dir="$1" local arch="${2:-x86_64}" + local mirror="${3:-edge}" local platform="" - local image_tag="omarchy-pkg-builder:latest-$arch" + local image_tag="omarchy-pkg-builder:latest-$arch-$mirror" case "$arch" in x86_64) platform="linux/amd64" ;; @@ -37,10 +38,11 @@ build_docker_image() { ;; esac - print_info "Building Docker image for $arch ($platform)..." + print_info "Building Docker image for $arch ($platform) using $mirror mirror..." docker buildx build \ --platform "$platform" \ + --build-arg MIRROR="$mirror" \ --load \ -t "$image_tag" \ -f "$build_dir/Dockerfile" \ diff --git a/helpers/paths.sh b/helpers/paths.sh index db1d154..ac3237b 100644 --- a/helpers/paths.sh +++ b/helpers/paths.sh @@ -1,8 +1,9 @@ # Common path variables for Omarchy package build system # This file should be sourced after setting BUILD_ROOT -# Default architecture +# Default architecture and mirror ARCH=${ARCH:-x86_64} +MIRROR=${MIRROR:-edge} # Core directories (architecture-independent) BUILD_DIR="$BUILD_ROOT/build" @@ -10,12 +11,12 @@ SRC_DIR="$BUILD_ROOT/src" LOG_DIR="$BUILD_ROOT/logs" PKGBUILDS_DIR="$BUILD_ROOT/pkgbuilds" -# Function to update architecture-specific paths -# Call this after changing ARCH variable +# Function to update architecture and mirror-specific paths +# Call this after changing ARCH or MIRROR variables update_arch_paths() { - BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$ARCH" # Unsigned packages - REPO_DIR="$BUILD_ROOT/pkgs.omarchy.org/$ARCH" # Repository (signed packages) + BUILD_OUTPUT_DIR="$BUILD_ROOT/build-output/$MIRROR/$ARCH" # Unsigned packages + REPO_DIR="$BUILD_ROOT/pkgs.omarchy.org/$MIRROR/$ARCH" # Repository (signed packages) } -# Initialize architecture-specific directories with default ARCH +# Initialize architecture-specific directories with default ARCH and MIRROR update_arch_paths