1.1 --- a/user-setup Sun Jun 16 01:00:18 2013 +0200
1.2 +++ b/user-setup Sun Jun 16 01:01:23 2013 +0200
1.3 @@ -22,12 +22,12 @@
1.4 . /etc/default/userinstall
1.5 else
1.6 echo "No defaults found for userinstall." 1>&2
1.7 - exit 1
1.8 + exit 1
1.9 fi
1.10
1.11 if [ "$1" = "--help" ]; then
1.12 - cat 1>&2 <<EOF
1.13 -Usage: `basename $0` [ --root ] [ <mirror> ]
1.14 + cat 1>&2 <<EOF
1.15 +Usage: `basename $0` [ --root [ --multistrap [ -f <config> ] ] ] [ <mirror> ]
1.16
1.17 Examples:
1.18
1.19 @@ -35,11 +35,25 @@
1.20 user-setup file:///tmp/$USERINSTALL_CODENAME/
1.21 user-setup http://ftp.xx.debian.org/debian/
1.22 user-setup --root http://ftp.xx.debian.org/debian/
1.23 +user-setup --root --multistrap http://ftp.xx.debian.org/debian/
1.24 EOF
1.25 - exit 1
1.26 + exit 1
1.27 elif [ "$1" = '--root' ]; then
1.28 AS_ROOT="$1"
1.29 - shift 1
1.30 + shift 1
1.31 + if [ "$1" = '--multistrap' ]; then
1.32 + USE_MULTISTRAP="$1"
1.33 + shift 1
1.34 + if [ "$1" = '-f' ]; then
1.35 + MULTISTRAP_CONFIG="$2"
1.36 + shift 2
1.37 + elif [ ! -e "userinstall-multistrap" ]; then
1.38 + MULTISTRAP_CONFIG="userinstall-multistrap"
1.39 + else
1.40 + echo "Any existing multistrap configuration file must be specified using the -f option." 1>&2
1.41 + exit 1
1.42 + fi
1.43 + fi
1.44 fi
1.45
1.46 if [ ! "$PACKAGEROOT" ] || [ "$PACKAGEROOT" = '/' ]; then
1.47 @@ -50,14 +64,48 @@
1.48 MIRROR="$1"
1.49 PATH=$PATH${PATH:+:}/usr/sbin:/sbin
1.50
1.51 -if [ "$AS_ROOT" ]; then
1.52 +# For multistrap, make a configuration file and use it to invoke multistrap.
1.53 +
1.54 +if [ "$USE_MULTISTRAP" ]; then
1.55 + if [ ! -e "$MULTISTRAP_CONFIG" ]; then
1.56 + DEBIAN_ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
1.57 + cat > "$MULTISTRAP_CONFIG" <<EOF
1.58 +[General]
1.59 +arch=$DEBIAN_ARCH
1.60 +cleanup=true
1.61 +noauth=false
1.62 +bootstrap=Debian
1.63 +aptsources=Debian
1.64 +
1.65 +[Debian]
1.66 +packages=gnupg
1.67 +source=$MIRROR
1.68 +keyring=$ARCHIVE_KEYRING
1.69 +suite=$USERINSTALL_CODENAME
1.70 +EOF
1.71 + fi
1.72 +
1.73 + if ! sudo multistrap -f "$MULTISTRAP_CONFIG" -d "$PACKAGEROOT" ; then
1.74 + cat 1>&2 <<EOF
1.75 +Failed to complete an installation of the chosen distribution.
1.76 +See the error messages above for more information.
1.77 +EOF
1.78 + exit 1
1.79 + fi
1.80 +
1.81 +# For normal root installations, use debootstrap.
1.82 +
1.83 +elif [ "$AS_ROOT" ]; then
1.84 if ! sudo debootstrap --include="gnupg,$KEYRING" "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR" ; then
1.85 cat 1>&2 <<EOF
1.86 Failed to complete an installation of the chosen distribution.
1.87 See the error messages above for more information.
1.88 EOF
1.89 - exit 1
1.90 + exit 1
1.91 fi
1.92 +
1.93 +# For non-root installations, use debootstrap with fakeroot and fakechroot.
1.94 +
1.95 else
1.96 if ! fakeroot fakechroot $FAKECHROOT_OPTIONS debootstrap --variant=fakechroot --include="gnupg,$KEYRING" \
1.97 "$USERINSTALL_CODENAME" "$PACKAGEROOT" "$MIRROR" ; then
1.98 @@ -65,7 +113,7 @@
1.99 Failed to complete an installation of the chosen distribution.
1.100 See the error messages above for more information.
1.101 EOF
1.102 - exit 1
1.103 + exit 1
1.104 fi
1.105 fi
1.106
2.1 --- a/userinstall-defaults Sun Jun 16 01:00:18 2013 +0200
2.2 +++ b/userinstall-defaults Sun Jun 16 01:01:23 2013 +0200
2.3 @@ -20,3 +20,4 @@
2.4
2.5 PACKAGEROOT="$HOME/.userinstall"
2.6 KEYRING=$(echo $USERINSTALL_ID | tr '[:upper:]' '[:lower:]')-keyring
2.7 +ARCHIVE_KEYRING=$(echo $USERINSTALL_ID | tr '[:upper:]' '[:lower:]')-archive-keyring