Files
files-for-dockers/base-image-script/debian-docker-build_pt3.sh
2025-07-05 06:33:06 -07:00

28 lines
753 B
Bash

#!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
set -e
ROOTFS_DIR="${1:-debian-bookworm}"
TARBALL="${ROOTFS_DIR}.tar.bz2"
echo "[INFO] Attempting to unmount 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/"debian-*_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"
# DO NOT DELETE TARBALL — needed by Gitea Action
# DO NOT UPLOAD HERE — handled by workflow
echo "[INFO] Leaving tarball for CI to upload: $TARBALL"