This commit is contained in:
2025-07-04 08:50:14 -07:00
parent 1198360ffa
commit 328c524085
9 changed files with 104 additions and 102 deletions

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
set -e set -e
# Alpine version # Alpine version

View File

@@ -1,4 +1,6 @@
#!/bin/sh #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
echo "[CHROOT] Inside Alpine rootfs" echo "[CHROOT] Inside Alpine rootfs"
echo "[CHROOT] Updating system..." echo "[CHROOT] Updating system..."

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
set -e set -e
ROOTFS_DIR="$1" ROOTFS_DIR="$1"

View File

@@ -1,59 +1,48 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2018 fithwum # Copyright (c) 2025 fithwum
# All rights reserved # All rights reserved
set -e
set -o pipefail
RELEASE=stable 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-${DEBIAN_RELEASE}_pt2.sh"
PT3_SCRIPT="debian-${DEBIAN_RELEASE}_pt3.sh"
echo " " echo "[INFO] Preparing environment..."
echo "INFO ! Downloading other parts of the script if needed." apt-get update -y
if [ -e /debian-bookworm_pt2.sh ] apt-get upgrade -y
then apt-get install -y --no-install-recommends debootstrap bash curl wget ftp-upload dirmngr
echo "INFO ! debian-bookworm_pt2.sh found ... will not download."
else echo "[INFO] Downloading extra scripts if missing..."
echo " " for SCRIPT in $PT2_SCRIPT $PT3_SCRIPT; do
echo "WARNING ! debian-bookworm_pt2.sh not found ... will download new copy." if [ ! -f "./$SCRIPT" ]; then
wget --no-cache https://raw.githubusercontent.com/fithwum/files-for-dockers/refs/heads/master/base-image-script/debian-bookworm_pt2.sh -O /debian-bookworm_pt2.sh echo "[INFO] Downloading $SCRIPT..."
chmod +x debian-bookworm_pt2.sh wget --no-cache "$SCRIPTS_URL/$SCRIPT" -O "./$SCRIPT"
chmod +x "./$SCRIPT"
fi fi
if [ -e /debian-bookworm_pt3.sh ] done
then
echo "INFO ! debian-bookworm_pt3.sh found ... will not download." echo "[INFO] Bootstrapping Debian $DEBIAN_RELEASE..."
else debootstrap \
echo " " --variant=minbase \
echo "WARNING ! debian-bookworm_pt3.sh not found ... will download new copy." --components=main,contrib,non-free \
wget --no-cache https://raw.githubusercontent.com/fithwum/files-for-dockers/refs/heads/master/base-image-script/debian-bookworm_pt3.sh -O /debian-bookworm_pt3.sh --include=apt,ca-certificates \
chmod +x debian-bookworm_pt3.sh --arch=amd64 \
fi "$DEBIAN_RELEASE" "$ROOTFS_DIR" http://deb.debian.org/debian/
sleep 1
echo " " echo "[INFO] Mounting system directories..."
echo "INFO ! Getting system updates." for dir in dev dev/pts proc sys; do
apt-get -y update mount --bind /$dir "$ROOTFS_DIR/$dir"
apt-get -y upgrade done
apt-get -y dist-upgrade
apt autoremove -y echo "[INFO] Copying pt2 script into chroot..."
echo " " cp "./$PT2_SCRIPT" "$ROOTFS_DIR/root/$PT2_SCRIPT"
echo "INFO ! Installing debootstrap,ftp-upload,bash,dirmngr,curl." chmod +x "$ROOTFS_DIR/root/$PT2_SCRIPT"
sleep 1
apt-get install -y debootstrap ftp-upload bash dirmngr curl echo "[INFO] Entering chroot. Type 'exit' when done."
sleep 1 chroot "$ROOTFS_DIR" /root/$PT2_SCRIPT
echo " "
echo "INFO ! Downloading debian & selected packages." echo "[INFO] Running pt3 for packaging and upload..."
debootstrap --force-check-gpg --variant=minbase --components=main,contrib,non-free --include=dirmngr,apt-transport-https,bash,software-properties-common,ca-certificates,wget,curl,nano --arch=amd64 bookworm /debian-bookworm http://deb.debian.org/debian/ ./$PT3_SCRIPT "$ROOTFS_DIR"
echo " "
echo "INFO ! Filesystem size uncompressed."
sleep 1
du --human-readable --summarize debian-bookworm
sleep 5
echo " "
echo "INFO ! Mounting folders for root."
mount --bind /dev debian-bookworm/dev
mount --bind /dev/pts debian-bookworm/dev/pts
mount --bind /proc debian-bookworm/proc
mount --bind /sys debian-bookworm/sys
sleep 1
cp -v debian-bookworm_pt2.sh /debian-bookworm
echo " "
echo "INFO ! Changeing to new root."
sleep 1
chroot debian-bookworm
exit

View File

@@ -1,20 +1,21 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2018 fithwum # Copyright (c) 2025 fithwum
# All rights reserved # All rights reserved
echo "[CHROOT] Configuring Debian system..."
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/10-assume_yes
echo " " apt-get update
echo "APT::Get::Assume-Yes \"true\";" | tee /etc/apt/apt.conf.d/10-assume_yes apt-get upgrade
sleep 1
echo " " apt-get install --no-install-recommends software-properties-common bash wget curl nano locales
echo "INFO ! Removeing unnecessary packages."
apt-get remove --allow-remove-essential pinentry-curses whiptail kmod iptables iproute2 dmidecode echo "[CHROOT] Removing unnecessary packages..."
sleep 1 apt-get remove --purge --allow-remove-essential pinentry-curses whiptail kmod iptables iproute2 dmidecode || true
echo " "
echo "INFO ! Cleanup." echo "[CHROOT] Cleaning up..."
apt-get clean apt-get clean
spt --fix-broken install apt-get install -f
find /var/lib/apt/lists/ -maxdepth 2 -type f -delete find /var/lib/apt/lists/ -type f -delete
sleep 1
echo " " echo "[CHROOT] Done. Type 'exit' to return."
echo "INFO ! Type "exit" and reboot for final steps."
exit exit

View File

@@ -1,33 +1,33 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2018 fithwum # Copyright (c) 2025 fithwum
# All rights reserved # All rights reserved
set -e
echo " " ROOTFS_DIR="${1:-debian-bookworm}"
echo "INFO ! Cleaning up pt2 of script from base image." TARBALL="${ROOTFS_DIR}.tar.bz2"
rm -frv /debian-bookworm/debian-bookworm_pt2.sh
sleep 1 echo "[INFO] Unmounting system directories..."
echo " " for dir in sys proc dev/pts dev; do
echo "INFO ! Base image size after cleanup." umount -lf "$ROOTFS_DIR/$dir"
du --human-readable --summarize debian-bookworm done
sleep 5
echo " " echo "[INFO] Removing chroot script..."
echo "INFO ! Creating base image archive." rm -f "$ROOTFS_DIR/root/debian-base_pt2.sh"
echo "INFO ! This may take some time."
tar -cjf debian-bookworm.tar.bz2 --directory debian-bookworm . echo "[INFO] Showing rootfs size..."
sleep 1 du -sh "$ROOTFS_DIR"
echo " "
echo "INFO ! Base image archive." echo "[INFO] Creating compressed base image..."
du --human-readable --summarize debian-bookworm.tar.bz2 tar -cjf "$TARBALL" -C "$ROOTFS_DIR" .
sleep 5
echo " " echo "[INFO] Image archive size:"
echo "INFO ! Uploading image to ftp server." du -sh "$TARBALL"
ftp-upload -v -h {IP}:{PORT} -u {USER} --password {PASSWORD} -d /mnt/user/FTP debian-bookworm.tar.bz2
sleep 1 # Optional: Upload via FTP
echo " " # ftp-upload -v -h "$HOST" -u "$USER" --password "$PASS" -d /target/dir "$TARBALL"
echo "INFO ! Removing temp files."
rm -fr debian-bookworm echo "[INFO] Cleaning up..."
rm -frv debian-bookworm.tar.bz2 rm -rf "$ROOTFS_DIR"
echo " " rm -f "$TARBALL"
echo "INFO ! Done."
echo " " echo "[INFO] Done."
exit

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
set -e set -e
set -o pipefail set -o pipefail

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
echo "[CHROOT] Configuring Debian system..." echo "[CHROOT] Configuring Debian system..."
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/10-assume_yes echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/10-assume_yes

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2025 fithwum
# All rights reserved
set -e set -e
ROOTFS_DIR="${1:-debian-bookworm}" ROOTFS_DIR="${1:-debian-bookworm}"