update and test script
This commit is contained in:
46
base-image-script/debian-test_pt1.sh
Normal file
46
base-image-script/debian-test_pt1.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
DEBIAN_RELEASE="bookworm"
|
||||
ROOTFS_DIR="debian-${DEBIAN_RELEASE}"
|
||||
SCRIPTS_URL="https://raw.githubusercontent.com/fithwum/files-for-dockers/refs/heads/master/base-image-script"
|
||||
PT2_SCRIPT="debian-base_pt2.sh"
|
||||
PT3_SCRIPT="debian-base_pt3.sh"
|
||||
|
||||
echo "[INFO] Preparing environment..."
|
||||
apt-get update -y
|
||||
apt-get upgrade -y
|
||||
apt-get install -y debootstrap bash curl wget ftp-upload dirmngr
|
||||
|
||||
echo "[INFO] Downloading extra scripts if missing..."
|
||||
for SCRIPT in $PT2_SCRIPT $PT3_SCRIPT; do
|
||||
if [ ! -f "./$SCRIPT" ]; then
|
||||
echo "[INFO] Downloading $SCRIPT..."
|
||||
wget --no-cache "$SCRIPTS_URL/$SCRIPT" -O "./$SCRIPT"
|
||||
chmod +x "./$SCRIPT"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[INFO] Bootstrapping Debian $DEBIAN_RELEASE..."
|
||||
debootstrap \
|
||||
--variant=minbase \
|
||||
--components=main,contrib,non-free \
|
||||
--include=ca-certificates,software-properties-common,bash,wget,curl,nano \
|
||||
--arch=amd64 \
|
||||
"$DEBIAN_RELEASE" "$ROOTFS_DIR" http://deb.debian.org/debian/
|
||||
|
||||
echo "[INFO] Mounting system directories..."
|
||||
for dir in dev dev/pts proc sys; do
|
||||
mount --bind /$dir "$ROOTFS_DIR/$dir"
|
||||
done
|
||||
|
||||
echo "[INFO] Copying pt2 script into chroot..."
|
||||
cp "./$PT2_SCRIPT" "$ROOTFS_DIR/root/$PT2_SCRIPT"
|
||||
chmod +x "$ROOTFS_DIR/root/$PT2_SCRIPT"
|
||||
|
||||
echo "[INFO] Entering chroot. Type 'exit' when done."
|
||||
chroot "$ROOTFS_DIR" /root/$PT2_SCRIPT
|
||||
|
||||
echo "[INFO] Running pt3 for packaging and upload..."
|
||||
./$PT3_SCRIPT "$ROOTFS_DIR"
|
||||
Reference in New Issue
Block a user