- Updated the Alpine aports submodule to the latest commit. - Modified the build script to clone the Alpine aports repository using the stable branch for better reliability. - Refined the Archipelago profile by adding a title and description, and streamlined the list of additional packages. - Adjusted the build date in hardware configuration files for HP ProDesk and merged overlays to reflect the latest build time.
119 lines
3.7 KiB
Bash
Executable File
119 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Native Alpine build script
|
|
# Must be run on Alpine Linux or in Alpine container
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
BUILD_TYPE="${1:-iso}"
|
|
|
|
ARCHIPELAGO_VERSION="${ARCHIPELAGO_VERSION:-0.1.0}"
|
|
ALPINE_VERSION="${ALPINE_VERSION:-3.19}"
|
|
ARCH="${ARCH:-x86_64}"
|
|
OUTPUT_DIR="${OUTPUT_DIR:-$SCRIPT_DIR/results}"
|
|
|
|
echo "🏔️ Building Alpine image natively"
|
|
echo ""
|
|
|
|
# Install build dependencies
|
|
echo "📦 Installing build dependencies..."
|
|
apk add --no-cache \
|
|
bash \
|
|
git \
|
|
alpine-sdk \
|
|
abuild \
|
|
alpine-conf \
|
|
syslinux \
|
|
xorriso \
|
|
squashfs-tools \
|
|
grub \
|
|
grub-efi \
|
|
mtools \
|
|
dosfstools \
|
|
e2fsprogs \
|
|
rsync \
|
|
|| true
|
|
|
|
# Setup abuild keys if needed
|
|
if [ ! -f ~/.abuild/abuild.conf ]; then
|
|
echo "🔑 Setting up abuild keys..."
|
|
abuild-keygen -a -n || true
|
|
fi
|
|
|
|
# Clone Alpine aports if needed
|
|
APORTS_DIR="$SCRIPT_DIR/aports"
|
|
if [ ! -d "$APORTS_DIR" ]; then
|
|
echo "📥 Cloning Alpine aports repository..."
|
|
git clone --depth=1 --branch "${ALPINE_VERSION}-stable" \
|
|
https://gitlab.alpinelinux.org/alpine/aports.git "$APORTS_DIR" || {
|
|
echo "⚠️ Failed to clone ${ALPINE_VERSION}-stable, trying 3.19-stable..."
|
|
git clone --depth=1 --branch "3.19-stable" \
|
|
https://gitlab.alpinelinux.org/alpine/aports.git "$APORTS_DIR" || {
|
|
echo "⚠️ Failed to clone 3.19-stable, using master as fallback..."
|
|
git clone --depth=1 https://gitlab.alpinelinux.org/alpine/aports.git "$APORTS_DIR"
|
|
}
|
|
}
|
|
fi
|
|
|
|
# Copy custom profile
|
|
echo "📝 Setting up custom Archipelago profile..."
|
|
# Copy profile script to Alpine scripts directory (force overwrite)
|
|
cp -f "$SCRIPT_DIR/alpine-profile/mkimg.archipelago.sh" "$APORTS_DIR/scripts/"
|
|
|
|
# Copy overlay files
|
|
PROFILE_DIR="$APORTS_DIR/scripts/mkimg.archipelago.d"
|
|
mkdir -p "$PROFILE_DIR"
|
|
cp -r "$SCRIPT_DIR/alpine-profile/overlay" "$PROFILE_DIR/" 2>/dev/null || true
|
|
|
|
# Build ISO or disk image
|
|
cd "$APORTS_DIR/scripts"
|
|
|
|
if [ "$BUILD_TYPE" = "iso" ]; then
|
|
echo "💿 Building ISO image..."
|
|
./mkimage.sh \
|
|
--arch "$ARCH" \
|
|
--profile archipelago \
|
|
--repository "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" \
|
|
--repository "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" \
|
|
--outdir "$OUTPUT_DIR" \
|
|
--tag "$ALPINE_VERSION" || {
|
|
echo "❌ ISO build failed"
|
|
exit 1
|
|
}
|
|
|
|
# Rename output
|
|
if [ -f "$OUTPUT_DIR/alpine-archipelago-${ALPINE_VERSION}-${ARCH}.iso" ]; then
|
|
mv "$OUTPUT_DIR/alpine-archipelago-${ALPINE_VERSION}-${ARCH}.iso" \
|
|
"$OUTPUT_DIR/archipelago-${ARCHIPELAGO_VERSION}-${ARCH}.iso"
|
|
fi
|
|
elif [ "$BUILD_TYPE" = "disk" ]; then
|
|
echo "💾 Building disk image..."
|
|
# Build ISO first, then convert to disk image
|
|
./mkimage.sh \
|
|
--arch "$ARCH" \
|
|
--profile archipelago \
|
|
--repository "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main" \
|
|
--repository "http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community" \
|
|
--outdir "$OUTPUT_DIR" \
|
|
--tag "$ALPINE_VERSION" || {
|
|
echo "❌ Image build failed"
|
|
exit 1
|
|
}
|
|
|
|
# Convert to disk image (will be done in install script)
|
|
echo "📦 Disk image will be created in install step"
|
|
else
|
|
echo "❌ Unknown build type: $BUILD_TYPE"
|
|
exit 1
|
|
fi
|
|
|
|
# Install Archipelago into the image
|
|
echo "🔧 Installing Archipelago components..."
|
|
"$SCRIPT_DIR/scripts/install-archipelago.sh" "$OUTPUT_DIR" || {
|
|
echo "⚠️ Archipelago installation had issues, but image was built"
|
|
}
|
|
|
|
echo ""
|
|
echo "✅ Build complete!"
|