summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--share/man/container-create-debootstrap.1.txt11
-rwxr-xr-xshare/scripts/debootstrap21
3 files changed, 27 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 9068d8c..e11d4fe 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,8 @@ install: build
ln -sf debconf $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/progress-linux
ln -sf debconf.d $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/progress-linux.d
ln -sf container-create-debconf.1 $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1
+ ln -sf debootstrap $(DESTDIR)/usr/share/$(PROJECT)/$(PROGRAM)/scripts/mmdebstrap
+ ln -sf container-create-debootstrap.1 $(DESTDIR)/usr/share/man/man1/container-create-mmdebstrap.1
ln -sf console $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/con
ln -sf list $(DESTDIR)/usr/lib/$(PROJECT)/$(PROGRAM)/ls
@@ -145,8 +147,9 @@ uninstall:
rm -f $(DESTDIR)/usr/bin/cntsh
rm -f $(DESTDIR)/usr/share/man/man1/cntsh.1
rm -f $(DESTDIR)/usr/share/bash-completion/completions/cnt
- rm -f $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1
rm -f $(DESTDIR)/usr/share/man/man1/container-create-debian.1
+ rm -f $(DESTDIR)/usr/share/man/man1/container-create-progress-linux.1
+ rm -f $(DESTDIR)/usr/share/man/man1/container-create-mmdebstrap.1
for FILE in share/sudo/*; \
do \
diff --git a/share/man/container-create-debootstrap.1.txt b/share/man/container-create-debootstrap.1.txt
index fc8651e..5268eb7 100644
--- a/share/man/container-create-debootstrap.1.txt
+++ b/share/man/container-create-debootstrap.1.txt
@@ -25,17 +25,18 @@ CONTAINER-CREATE-DEBOOTSTRAP(1)
NAME
----
-container-create-debootstrap - Create a basic Debian based container with debootstrap
+container-create-debootstrap - Create a basic Debian based container with debootstrap or mmdebstrap
SYNOPSIS
--------
*container create -s debootstrap* ['OPTIONS']
+*container create -s mmdebstrap* ['OPTIONS']
DESCRIPTION
-----------
-The debootstrap container creation script uses debootstrap(8) to create a Debian based container.
+The debootstrap container creation script uses debootstrap(8) or mmdebstrap(1) to create a Debian based container.
This script creates a pure Debian system with three modificiations:
@@ -66,11 +67,11 @@ The following script options are available:
EXAMPLES
--------
-*Create a Debian 9 (stretch) based container with same architecture as the host system:*::
+*Create a Debian 9 (stretch) based container with same architecture as the host system using debootstrap:*::
sudo container create -s debootstrap -n stretch.example.net
-*Create a Debian 9 (stretch) based container with different architecture as the host system:*::
- sudo container create -s debootstrap -n stretch-i386.example.net -- -a i386
+*Create a Debian 9 (stretch) based container with different architecture as the host system using mmdebstrap:*::
+ sudo container create -s mmdebstrap -n stretch-i386.example.net -- -a i386
SEE ALSO
diff --git a/share/scripts/debootstrap b/share/scripts/debootstrap
index 7b73c26..61f5e13 100755
--- a/share/scripts/debootstrap
+++ b/share/scripts/debootstrap
@@ -22,7 +22,8 @@ set -e
PROJECT="open-infrastructure"
SOFTWARE="compute-tools"
PROGRAM="container"
-SCRIPT="${0}"
+
+SCRIPT="$(basename ${0})"
HOOKS="/etc/${PROJECT}/${PROGRAM}/hooks"
MACHINES="/var/lib/machines"
@@ -127,9 +128,21 @@ then
exit 1
fi
-if [ ! -x /usr/sbin/debootstrap ]
+case "${SCRIPT}" in
+ debootstrap)
+ BOOTSTRAP="/usr/sbin/debootstrap"
+ BOOTSTRAP_OPTIONS=""
+ ;;
+
+ mmdebstrap)
+ BOOTSTRAP="/usr/bin/mmdebstrap"
+ BOOTSTRAP_OPTIONS="--mode=root"
+ ;;
+esac
+
+if [ ! -x "${BOOTSTRAP}" ]
then
- echo "'${NAME}': /usr/sbin/debootstrap - no such file." >&2
+ echo "'${NAME}': ${BOOTSTRAP} - no such file." >&2
exit 1
fi
@@ -163,7 +176,7 @@ done
mkdir -p "${MACHINES}"
-debootstrap --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${MACHINES}/${NAME} ${MIRROR}
+${BOOTSTRAP} ${BOOTSTRAP_OPTIONS} --arch=${ARCHITECTURE} --include=${INCLUDE} ${DISTRIBUTION} ${MACHINES}/${NAME} ${MIRROR}
chroot "${MACHINES}/${NAME}" apt clean
# Setting hostname