[Emdebian-logs] [SCM] Root filesystem generation tool (multistrap wrapper) branch, master, updated. 36b15b89f2b4c5a577330957252f98a5ce01ff13

josch josch at pyneo.org
Tue Mar 13 15:01:55 UTC 2012


The following commit has been merged in the master branch:
commit 827b6140c51b892c651dc3fa303386e26d5ff165
Author: josch <josch at pyneo.org>
Date:   Tue Mar 13 15:54:52 2012 +0100

    add options for force and verbose

diff --git a/polystrap.sh b/polystrap.sh
index 2536a81..be5277c 100755
--- a/polystrap.sh
+++ b/polystrap.sh
@@ -26,7 +26,7 @@
 set -e
 
 usage() {
-	echo "Usage: $0: [-n] [-s suite] [-a arch] [-d directory] [-m mirror] [-p packages] platform\n" >&2
+	echo "Usage: $0: [-f] [-v] [-n] [-s suite] [-a arch] [-d directory] [-m mirror] [-p packages] platform\n" >&2
 }
 
 export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C
@@ -38,8 +38,9 @@ if [ "$FAKEROOTKEY" = "" ]; then
 	exit
 fi
 
+FORCE=""
 MSTRAP_SIM=
-while getopts s:a:d:m:p:n opt; do
+while getopts fvs:a:d:m:p:n opt; do
 	case $opt in
 	s) _SUITE="$OPTARG";;
 	a) _ARCH="$OPTARG";;
@@ -47,6 +48,8 @@ while getopts s:a:d:m:p:n opt; do
 	m) _MIRROR="$OPTARG";;
 	p) _PACKAGES="$OPTARG";;
 	n) MSTRAP_SIM="--simulate";;
+	v) set -x;;
+	f) FORCE=true;;
 	?) usage; exit 1;;
 	esac
 done
@@ -92,8 +95,17 @@ echo "I: mirror:  $MIRROR"
 echo "I: pkgs:    $PACKAGES"
 echo "I: --------------------------"
 
-[ -e "$ROOTDIR.tar" ] && { echo "tarball $ROOTDIR.tar still exists" >&2; exit 1; }
-[ -e "$ROOTDIR" ] && { echo "root directory $ROOTDIR still exists" >&2; exit 1; }
+[ -e "$ROOTDIR.tar" ] && [ ! "$FORCE" = true ] && { echo "tarball $ROOTDIR.tar still exists" >&2; exit 1; }
+
+# if rootdir exists, either warn and abort or delete and continue
+if [ -e "$ROOTDIR" ]; then
+	if [ "$FORCE" = true ]; then
+		rm -rf $ROOTDIR
+	else
+		echo "root directory $ROOTDIR still exists" >&2
+		exit 1
+	fi
+fi
 
 # create multistrap.conf
 echo "I: create multistrap.conf"
@@ -126,8 +138,12 @@ fi
 
 # run preinst scripts
 for script in $ROOTDIR/var/lib/dpkg/info/*.preinst; do
-	[ "$script" = "$ROOTDIR/var/lib/dpkg/info/bash.preinst" ] && continue
+	#[ "$script" = "$ROOTDIR/var/lib/dpkg/info/bash.preinst" ] && continue
+	#[ "$script" = "$ROOTDIR/var/lib/dpkg/info/module-init-tools.preinst" ] && continue
+	[ "$script" = "$ROOTDIR/var/lib/dpkg/info/vpnc.preinst" ] && continue
 	echo "I: run preinst script ${script##$ROOTDIR}"
+	DPKG_MAINTSCRIPT_NAME=preinst \
+	DPKG_MAINTSCRIPT_PACKAGE="`basename $script .preinst`" \
 	fakechroot chroot $ROOTDIR ${script##$ROOTDIR} install
 done
 

-- 
Root filesystem generation tool (multistrap wrapper)



More information about the Emdebian-logs mailing list