#!/bin/sh PROG=$(basename $0) DIST=testing ARCH=amd64 MIRROR=http://ftp2.fr.debian.org/debian if [ $EUID -ne 0 ]; then echo $PROG "must be run as root" 1>&2 exit 1 fi CHROOT=/home/davidcl/work/tools/debian-chroot SCI=/home/davidcl/work/branches/master/scilab SCI_REVIEW=/home/davidcl/work/branches/master-review/scilab RELEASES=/home/davidcl/work/releases # locale might be set but not supported by the chroot unset LANG LC_CTYPE LC_MESSAGES LC_ALL # setup is not existing if [ ! -d $CHROOT ]; then echo -e "\033[1m==== Debootstrap to $DIST $ARCH ====\033[0m" debootstrap --no-check-certificate --arch=$ARCH $DIST $CHROOT $MIRROR || { exit 1; } fi # mount SCI first then chroot into echo -e "\033[1m==== Mount system dirs ====\033[0m" mount proc $CHROOT/proc -t proc mount sysfs $CHROOT/sys -t sysfs mount -o bind /tmp $CHROOT/tmp echo -e "\033[1m==== Mount local dirs ====\033[0m" echo "mount $SCI as /scilab" [ ! -d $CHROOT/scilab ] && mkdir $CHROOT/scilab mount -o bind $SCI $CHROOT/scilab echo "mount $SCI_REVIEW as /scilab-review" [ ! -d $CHROOT/scilab-review ] && mkdir $CHROOT/scilab-review mount -o bind $SCI_REVIEW $CHROOT/scilab-review echo "mount $RELEASES as /releases" [ ! -d $CHROOT/releases ] && mkdir $CHROOT/releases mount -o bind $RELEASES $CHROOT/releases # Update the chroot first then subshell into echo -e "\033[1m==== update chroot ====\033[0m" xauth list > /tmp/X echo "deb $MIRROR unstable main contrib non-free" >$CHROOT/etc/apt/sources.list echo "deb $MIRROR testing main contrib non-free" >>$CHROOT/etc/apt/sources.list echo "deb $MIRROR stable main contrib non-free" >>$CHROOT/etc/apt/sources.list chroot $CHROOT /bin/bash <<'EOF' # add a default user named build if not existing if [ -z $(id -u build 2>/dev/null) ]; then useradd -u 1000 -m build -s /bin/bash fi apt-get install -y --force-yes automake=1:1.14.1-* autoconf=2.69-* gettext=0.18.3.* libtool=2.4.2-* EOF # then chroot into echo -e "\033[1m==== chroot to $DIST $ARCH ====\033[0m" chroot $CHROOT su - build # At the end umount previously mounted dirs umount -f $CHROOT/proc umount -f $CHROOT/sys umount -f $CHROOT/tmp umount -f $CHROOT/scilab umount -f $CHROOT/scilab-review umount -f $CHROOT/releases