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
esac
}
+do_config() {
+ local tmpschrootconf=$(tempfile)
+ cleanup+=("rm -f $tmpschrootconf")
+ genschrootconf "$suite" "$arch" "$target" > "$tmpschrootconf"
+ if ! [ -e "$schrootconfig" ] || ! diff "$schrootconfig" "$tmpschrootconf" > /dev/null; then
+ mv "$tmpschrootconf" "$schrootconfig"
+ chmod 644 "$schrootconfig"
+ fi
+}
+
set -e
set -u
sbuildnames=""
ubuntu=""
groupuser="Debian,guest"
-grouproot="adm"
+grouproot=""
declare -a cleanup
trap do_cleanup EXIT
#
# let's go
#
-genschrootconf "$suite" "$arch" "$target" | tee "$schrootconfig"
-if [ -n "$configonly" ]; then exit 0; fi
+if [ -n "$configonly" ]; then
+ do_config
+ exit 0
+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 \
--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"
chroot "$rootdir" apt-get update
chroot "$rootdir" apt-get install -y --force-yes --no-install-recommends policyrcd-script-zg2
[ -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
rm -f "$rootdir/etc/apt/sources.list" "$rootdir/etc/apt/sources.list.d/*"
+chroot "$rootdir" apt-get clean
umount "$rootdir/sys" || true
tartmp=$(tempfile --directory "$basedir" --suffix=".tar.gz")
cleanup+=("rm -f $tartmp")
(cd "$rootdir" && tar caf "$tartmp" . && mv "$tartmp" "$target")
+
+do_config