i386 구조 ISO 빌드와 현장 절차 문서화

This commit is contained in:
2026-06-01 23:26:44 +09:00
parent 14f68278bc
commit bdd59c65a1
3 changed files with 92 additions and 12 deletions

View File

@@ -1,13 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
WORKDIR=${WORKDIR:-/root/tailrescue-live}
ARCH=${ARCH:-amd64}
WORKDIR=${WORKDIR:-/root/tailrescue-live-$ARCH}
OUTDIR=${OUTDIR:-/root/tailrescue-dist}
ISO_NAME=${ISO_NAME:-tailrescue-headscale-$(date +%Y%m%d-%H%M).iso}
ISO_NAME=${ISO_NAME:-tailrescue-headscale-${ARCH}-$(date +%Y%m%d-%H%M).iso}
DIST=${DIST:-bookworm}
RESCUE_ENV=${RESCUE_ENV:-rescue.env}
AUTHORIZED_KEYS=${AUTHORIZED_KEYS:-templates/authorized_keys}
case "$ARCH" in
amd64) KERNEL_PKG=linux-image-amd64 ;;
i386) KERNEL_PKG=linux-image-686-pae ;;
*) echo "unsupported ARCH=$ARCH; use amd64 or i386" >&2; exit 2 ;;
esac
if [[ ! -f "$RESCUE_ENV" ]]; then
echo "missing $RESCUE_ENV; copy templates/rescue.env.example and fill field secrets" >&2
exit 2
@@ -20,11 +27,13 @@ cd "$WORKDIR"
lb config \
--distribution "$DIST" \
--architectures "$ARCH" \
--archive-areas "main contrib non-free non-free-firmware" \
--binary-images iso-hybrid \
--bootappend-live "boot=live components hostname=tailrescue username=rescue"
--bootappend-live "boot=live components hostname=tailrescue username=rescue console=tty0 console=ttyS0,115200n8"
cat > config/package-lists/tailrescue.list.chroot <<"PKGS"
cat > config/package-lists/tailrescue.list.chroot <<PKGS
$KERNEL_PKG
systemd-sysv
openssh-server
sudo
@@ -71,11 +80,15 @@ PKGS
mkdir -p config/includes.chroot/etc/apt/keyrings config/includes.chroot/etc/apt/sources.list.d
curl -fsSL https://pkgs.tailscale.com/stable/debian/${DIST}.noarmor.gpg \
-o config/includes.chroot/etc/apt/keyrings/tailscale-archive-keyring.gpg
cat > config/includes.chroot/etc/apt/sources.list.d/tailscale.list <<TAILSRC
deb [signed-by=/etc/apt/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/debian ${DIST} main
TAILSRC
case "$ARCH" in
amd64) TAILSCALE_DEB_ARCH=amd64 ;;
i386) TAILSCALE_DEB_ARCH=i386 ;;
esac
TAILSCALE_VERSION=${TAILSCALE_VERSION:-1.98.4}
TAILSCALE_DEB="tailscale_${TAILSCALE_VERSION}_${TAILSCALE_DEB_ARCH}.deb"
TAILSCALE_DEB_URL="https://pkgs.tailscale.com/stable/debian/pool/${TAILSCALE_DEB}"
mkdir -p config/packages.chroot
(cd config/packages.chroot && apt-get download tailscale)
curl -fsSL "$TAILSCALE_DEB_URL" -o "config/packages.chroot/$TAILSCALE_DEB"
mkdir -p config/includes.chroot/etc/tailrescue
cp "$OLDPWD/$RESCUE_ENV" config/includes.chroot/etc/tailrescue/rescue.env
@@ -154,7 +167,8 @@ RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
SVC
ln -sf /etc/systemd/system/tailrescue-firstboot.service config/includes.chroot/etc/systemd/system/multi-user.target.wants/tailrescue-firstboot.service 2>/dev/null || true
mkdir -p config/includes.chroot/etc/systemd/system/multi-user.target.wants
ln -sf ../tailrescue-firstboot.service config/includes.chroot/etc/systemd/system/multi-user.target.wants/tailrescue-firstboot.service
mkdir -p config/hooks/normal
cat > config/hooks/normal/0900-tailrescue-users.hook.chroot <<"HOOK"
@@ -190,6 +204,6 @@ elif [[ -f "$OLDPWD/templates/authorized_keys.example" ]]; then
fi
lb build
cp -f live-image-amd64.hybrid.iso "$OUTDIR/$ISO_NAME"
(cd "$OUTDIR" && sha256sum "$ISO_NAME" > SHA256SUMS && echo "$ISO_NAME" > latest.txt)
cp -f "live-image-${ARCH}.hybrid.iso" "$OUTDIR/$ISO_NAME"
(cd "$OUTDIR" && sha256sum "$ISO_NAME" > "SHA256SUMS.${ARCH}" && cp "SHA256SUMS.${ARCH}" SHA256SUMS && echo "$ISO_NAME" > "latest.${ARCH}.txt" && cp "latest.${ARCH}.txt" latest.txt)
echo "$OUTDIR/$ISO_NAME"