X-Git-Url: https://piware.de/gitweb/?p=bin.git;a=blobdiff_plain;f=makechroot;h=76201b1e97616558ed649a310dfc0d71618f5052;hp=1028c213ba6e197a3531a86c2ee867036afffb51;hb=4f3fa2a9d54689cd022d3aaea7812bfd54faf767;hpb=e630f8d057665e5f0e1e1a48b3030320f28948a2 diff --git a/makechroot b/makechroot index 1028c21..76201b1 100755 --- a/makechroot +++ b/makechroot @@ -3,12 +3,21 @@ DIST="$1" DIR="$2" MIRROR="$3" +[ "$DIST" ] && [ "$DIR" ] && [ "$MIRROR" ] || { + echo "Usage: $0 " >&2 + exit 1 +} + mkdir -p "$DIR" debootstrap "$DIST" "$DIR" "$MIRROR" +chroot $DIR apt-get install locales # debian_chroot echo $DIST > $DIR/etc/debian_chroot +# hosts +echo "127.0.0.1 localhost.localdomain localhost" > $DIR/etc/hosts + # users perl -naF: -e 'print if $F[2] >= 1000 and $F[2] < 2000' /etc/passwd >> $DIR/etc/passwd @@ -20,7 +29,7 @@ if ! grep -q $DIR /etc/fstab; then cat <> /etc/fstab # $DIST chroot -/home $DIR/home none bind 0 0 +/home $DIR/home none rbind 0 0 /proc $DIR/proc none bind 0 0 /sys $DIR/sys none bind 0 0 /tmp $DIR/tmp none bind 0 0 @@ -32,6 +41,10 @@ EOF fi # apt sources +if [ "$MIRROR" != "${MIRROR%file://}" ]; then + MIRROR=http://archive.ubuntu.com/ubuntu +fi + cat < $DIR/etc/apt/sources.list deb $MIRROR $DIST main restricted universe multiverse deb-src $MIRROR $DIST main restricted universe multiverse @@ -46,5 +59,5 @@ EOF chroot $DIR apt-get update # common packages for development -chroot $DIR apt-get install -y build-essential devscripts fakeroot +chroot $DIR apt-get install -y build-essential fakeroot