X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fporterbox%2Ffiles%2Fsetup-dchroot;h=f09c8bbebfddb9b794f52aaed3358f097ad24b24;hb=c08c57eb5bbc461cda5498e4602bd49a861b9cac;hp=40ca8fe329f9f154333b5320ac55ffd5eed8b9c1;hpb=6c1ddb4d3292d02659f13442e82a89a63ab006ae;p=mirror%2Fdsa-puppet.git diff --git a/modules/porterbox/files/setup-dchroot b/modules/porterbox/files/setup-dchroot index 40ca8fe32..f09c8bbeb 100755 --- a/modules/porterbox/files/setup-dchroot +++ b/modules/porterbox/files/setup-dchroot @@ -39,6 +39,7 @@ OPTIONS: -a ARCH debootstrap arch [$arch] -m MIRROR http mirror to use [$mirror] -b basedir place where to put the tarball [$basedir] + -B install less stuff into chroot -c write config only -d dir place where to build the chroot [${builddir:-$basedir}] -f overwrite config and target tarball @@ -89,15 +90,11 @@ type=file file=$target groups=$groupuser root-groups=$grouproot -source-groups=adm -source-root-groups=adm +#source-groups=adm +#source-root-groups=adm EOF - if dpkg --compare-versions "$(lsb_release --release --short)" '<' 7; then - echo "script-config=$personality/config" - else - echo "profile=$personality" - fi + echo "profile=$personality" if [ "$THISARCH" = "$arch" ]; then echo "aliases=$suite" @@ -151,11 +148,12 @@ personality="dsa" sbuildnames="" ubuntu="" groupuser="Debian,guest" -grouproot="adm" +grouproot="" +bare="" declare -a cleanup trap do_cleanup EXIT -while getopts "a:b:cd:fg:hk:m:p:r:su" OPTION +while getopts "a:b:Bcd:fg:hk:m:p:r:su" OPTION do case $OPTION in a) @@ -164,6 +162,9 @@ do b) basedir="$OPTARG" ;; + B) + bare="1" + ;; c) configonly="1" ;; @@ -236,6 +237,14 @@ fi rootdir=$(mktemp -d "$builddir/create-$suite-XXXXXX") cleanup+=("rm -r $rootdir") cleanup+=("umount $rootdir/sys") +script=/usr/share/debootstrap/scripts/"$suite" +if ! [ -e "$script" ]; then + if [ -z "$ubuntu" ]; then + script=/usr/share/debootstrap/scripts/sid + else + script=/usr/share/debootstrap/scripts/gutsy + fi +fi set -x debootstrap \ @@ -243,8 +252,22 @@ debootstrap \ --include="apt" \ --variant=buildd \ --arch="$arch" \ - "$suite" "$rootdir" "$mirror" -echo "$tuple" > $rootdir/etc/debian_chroot + "$suite" "$rootdir" "$mirror" "$script" +echo "$tuple" > "$rootdir/etc/debian_chroot" +echo "force-unsafe-io" > "$rootdir/etc/dpkg/dpkg.cfg.d/force-unsafe-io" + +cleanup+=("umount $rootdir/dev") +case "$(uname -s)" in + Linux) + ;; + GNU/kFreeBSD) + mount -t devfs none "$rootdir/dev" + ;; + *) + echo >&2 "Warning: Unexpected uname -s output." + ;; +esac + chroot "$rootdir" apt-get update chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends policyrcd-script-zg2 @@ -267,10 +290,12 @@ done EOF chmod +x "$rootdir/usr/local/sbin/policy-rc.d" [ -z "$ubuntu" ] && chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends locales-all -chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends zsh build-essential less vim fakeroot devscripts gdb +chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends build-essential +[ -z "$bare" ] && chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends zsh less vim fakeroot devscripts gdb rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*" chroot "$rootdir" apt-get clean -umount "$rootdir/sys" || true +umount "$rootdir/dev" 2>/dev/null || true +umount "$rootdir/sys" 2>/dev/null || true tartmp=$(tempfile --directory "$basedir" --suffix=".tar.gz") cleanup+=("rm -f $tartmp")