summaryrefslogtreecommitdiffstats
path: root/share/create-scripts/debootstrap
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-08-19 07:50:51 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-08-19 09:20:40 +0000
commitc0060c31fdf1c2af1454c5877c311b6680618084 (patch)
treed85f1dac8fbc7ab60a55acef6a4a777893d2209a /share/create-scripts/debootstrap
parentAdding cdebootstrap support. (diff)
downloadcompute-tools-c0060c31fdf1c2af1454c5877c311b6680618084.tar.xz
compute-tools-c0060c31fdf1c2af1454c5877c311b6680618084.zip
Refactor debootstrap create script (FIXME WIP).
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
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}"