summaryrefslogtreecommitdiffstats
path: root/share/create-scripts/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xshare/create-scripts/bootstrap (renamed from share/create-scripts/debootstrap)27
1 files changed, 14 insertions, 13 deletions
diff --git a/share/create-scripts/debootstrap b/share/create-scripts/bootstrap
index bef75b1..a332d4d 100755
--- a/share/create-scripts/debootstrap
+++ b/share/create-scripts/bootstrap
@@ -24,6 +24,7 @@ SOFTWARE="compute-tools"
PROGRAM="container"
SCRIPT="$(basename ${0})"
+DIRECTORY="$(dirname ${0})"
HOOKS="/etc/${SOFTWARE}/hooks"
MACHINES="/var/lib/machines"
@@ -109,15 +110,15 @@ case "${SCRIPT}" in
BOOTSTRAP_OPTIONS=""
;;
- debootstrap)
- BOOTSTRAP="/usr/sbin/debootstrap"
- BOOTSTRAP_OPTIONS=""
- ;;
-
mmdebstrap)
BOOTSTRAP="/usr/bin/mmdebstrap"
BOOTSTRAP_OPTIONS="--mode=root"
;;
+
+ *)
+ BOOTSTRAP="/usr/sbin/debootstrap"
+ BOOTSTRAP_OPTIONS=""
+ ;;
esac
if [ ! -x "${BOOTSTRAP}" ]
@@ -135,7 +136,6 @@ fi
ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}"
DISTRIBUTION="${DISTRIBUTION:-bullseye}"
MIRROR="${MIRROR:-https://deb.debian.org/debian}"
-PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}"
INCLUDE="dbus"
@@ -158,15 +158,16 @@ done
mkdir -p "${MACHINES}"
${BOOTSTRAP} ${BOOTSTRAP_OPTIONS} --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${MACHINES}/${NAME} ${MIRROR}
-# Cleaning apt cache
-chroot "${MACHINES}/${NAME}" apt clean
+SYSTEM_NAME="${NAME}"
+SYSTEM_PATH="${MACHINES}/${NAME}"
+SYSTEM_ROOT_PASSWORD="${PASSWORD}"
-# Setting hostname
-echo "${NAME}" > "${MACHINES}/${NAME}/etc/hostname"
+export SYSTEM_NAME SYSTEM_PATH SYSTEM_ROOT_PASSWORD
-# Setting root password
-echo root:${PASSWORD} | chroot "${MACHINES}/${NAME}" chpasswd
-echo "${NAME}: root password set to '${PASSWORD}'."
+# Customization
+"${DIRECTORY}"/parts/chroot_clean-apt-archives
+"${DIRECTORY}"/parts/chroot_config-root-password
+"${DIRECTORY}"/parts/chroot_config-system-hostname
# Post hooks
for FILE in "${HOOKS}/post-${SCRIPT}".* "${HOOKS}/${NAME}.post-${SCRIPT}"