Some checks failed
Build and Upload Multiple Debian RootFS Versions / build-debian-variants (bookworm) (push) Failing after 1m36s
Build and Upload Multiple Debian RootFS Versions / build-debian-variants (bullseye) (push) Failing after 1m49s
Build and Upload Multiple Debian RootFS Versions / build-debian-variants (buster) (push) Failing after 1m19s
Build and Upload Multiple Debian RootFS Versions / build-debian-variants (docker-build) (push) Failing after 2m25s
37 lines
935 B
Bash
37 lines
935 B
Bash
#!/bin/bash
|
|
# Copyright (c) 2025 fithwum
|
|
# All rights reserved
|
|
set -e
|
|
|
|
# Auto-detect a single debian-* directory if not passed
|
|
if [ -n "$1" ]; then
|
|
ROOTFS_DIR="$1"
|
|
else
|
|
ROOTFS_DIR=$(find . -maxdepth 1 -type d -name "debian-*" | sed 's|^\./||' | head -n 1)
|
|
if [ -z "$ROOTFS_DIR" ]; then
|
|
echo "[ERROR] No debian-* rootfs directory found!"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
TARBALL="/output/${ROOTFS_DIR}.tar.bz2"
|
|
|
|
echo "[INFO] Unmounting system directories (ignore errors)..."
|
|
for dir in sys proc dev/pts dev; do
|
|
umount -lf "$ROOTFS_DIR/$dir" 2>/dev/null || true
|
|
done
|
|
|
|
echo "[INFO] Removing chroot script..."
|
|
rm -f "$ROOTFS_DIR/root/${ROOTFS_DIR}_pt2.sh" 2>/dev/null || true
|
|
|
|
echo "[INFO] Rootfs size:"
|
|
du -sh "$ROOTFS_DIR"
|
|
|
|
echo "[INFO] Creating compressed base image..."
|
|
tar -cjf "$TARBALL" -C "$ROOTFS_DIR" .
|
|
|
|
echo "[INFO] Image archive size:"
|
|
du -sh "$TARBALL"
|
|
|
|
echo "[INFO] Tarball ready for CI to upload: $TARBALL"
|