52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
DOTFILES_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
WORK_DIR="/tmp/m-archy-build"
|
|
OUT_DIR="${1:-/tmp/m-archy-out}"
|
|
PROFILE="$WORK_DIR/profile"
|
|
RELENG="/usr/share/archiso/configs/releng"
|
|
|
|
if ! command -v mkarchiso &>/dev/null; then
|
|
echo "Installing archiso..."
|
|
sudo pacman -S --noconfirm archiso
|
|
fi
|
|
|
|
[[ -d "$RELENG" ]] || { echo "ERROR: $RELENG not found — is archiso installed?"; exit 1; }
|
|
|
|
rm -rf "$WORK_DIR"
|
|
mkdir -p "$WORK_DIR" "$OUT_DIR"
|
|
|
|
echo "Copying releng base profile..."
|
|
cp -r "$RELENG" "$PROFILE"
|
|
|
|
echo "Applying M-Archy overlay..."
|
|
cp -r "$SCRIPT_DIR/overlay/airootfs/." "$PROFILE/airootfs/"
|
|
|
|
echo "Replacing profiledef..."
|
|
cp "$SCRIPT_DIR/overlay/profiledef.sh" "$PROFILE/profiledef.sh"
|
|
|
|
echo "Adding extra packages..."
|
|
while IFS= read -r pkg || [[ -n "$pkg" ]]; do
|
|
[[ -z "$pkg" || "$pkg" == \#* ]] && continue
|
|
grep -qxF "$pkg" "$PROFILE/packages.x86_64" || echo "$pkg" >> "$PROFILE/packages.x86_64"
|
|
done < "$SCRIPT_DIR/overlay/packages.extra"
|
|
|
|
echo "Embedding installer scripts..."
|
|
mkdir -p "$PROFILE/airootfs/root/installer"
|
|
cp "$DOTFILES_DIR/setup/archbaseos-guided-install.sh" "$PROFILE/airootfs/root/installer/"
|
|
cp "$DOTFILES_DIR/setup/arch-autoinstall.sh" "$PROFILE/airootfs/root/installer/"
|
|
|
|
chmod 755 \
|
|
"$PROFILE/airootfs/root/launch.sh" \
|
|
"$PROFILE/airootfs/usr/local/bin/install-arch" \
|
|
"$PROFILE/airootfs/root/installer/"*.sh
|
|
|
|
echo "Building ISO (this may take a while)..."
|
|
sudo mkarchiso -v -w "$WORK_DIR/mkarchiso" -o "$OUT_DIR" "$PROFILE"
|
|
|
|
echo
|
|
echo "Done."
|
|
ls -lh "$OUT_DIR/"*.iso 2>/dev/null || true
|