dev/chroot-test/run-test
branchdebian
changeset 277 265b258904d2
parent 274 ec60311ce2a6
child 282 1239880543cf
equal deleted inserted replaced
261:b6e65bddda7c 277:265b258904d2
       
     1 #!/bin/sh
       
     2 
       
     3 # Must be root to run this
       
     4 
       
     5 set -e
       
     6 
       
     7 DEBVERSION=sid
       
     8 
       
     9 PRISTINE=/var/local/cache/pristine/$DEBVERSION
       
    10 
       
    11 if [ ! -e $PRISTINE ] ; then
       
    12     echo "Missing:" $PRISTINE
       
    13     echo "Debian pristine image not found, try running these commands as root:"
       
    14     echo mkdir -p /var/local/cache/pristine
       
    15     echo debootstrap $DEBVERSION $PRISTINE http://ftp.uk.debian.org/debian/
       
    16     exit -1
       
    17 fi
       
    18 
       
    19 TOPDIR=`pwd`
       
    20 mkdir -p $TOPDIR/build/env
       
    21 BACKING=$TOPDIR/build/env/backing
       
    22 MOUNT=$TOPDIR/build/env/mount
       
    23 if [ -e $MOUNT ] ; then
       
    24     echo "Removing old filesystem"
       
    25     # FIXME: evil hack!
       
    26     chroot $MOUNT /etc/init.d/ssh stop || true
       
    27     umount $MOUNT/proc || true
       
    28     umount $MOUNT || true
       
    29     rm -rf $MOUNT
       
    30 fi
       
    31 if [ -e $BACKING ] ; then
       
    32     echo "Copying deb files into cache"
       
    33     cp $BACKING/var/cache/apt/archives/* build/aptcache/$DEBVERSION || true
       
    34     echo "Deleting old filesystem backing store"
       
    35     rm -rf $BACKING
       
    36 fi
       
    37 mkdir $BACKING $MOUNT
       
    38 
       
    39 touch $BACKING/please-trash-this-system
       
    40 mkdir -p $BACKING/etc
       
    41 echo "pristine" > $BACKING/etc/debian_chroot
       
    42 cp -v policy-rc.d $BACKING/etc/policy-rc.d
       
    43 
       
    44 mkdir -p $BACKING/var/cache/apt/archives
       
    45 echo "Copying deb files out of cache"
       
    46 cp build/aptcache/$DEBVERSION/* $BACKING/var/cache/apt/archives || true
       
    47 
       
    48 cp -av action $BACKING
       
    49 #hg -R ../mercurial-server archive -r default $BACKING/action/mercurial-server
       
    50 ( cd $(hg root) && \
       
    51     hg st -mac0n | cpio -p -0 -d $BACKING/action/mercurial-server )
       
    52 
       
    53 #cp ../mercurial-server/build/debian/mercurial-server_1.0-1_all.deb $BACKING/action
       
    54 
       
    55 unionfs-fuse -o cow -o allow_other,suid,dev $BACKING=RW:$PRISTINE=RO $MOUNT
       
    56 
       
    57 #mount --bind /dev "$MOUNT/dev"
       
    58 #mount --bind /dev/pts "$MOUNT/dev/pts"
       
    59 mount -t proc proc $MOUNT/proc
       
    60 
       
    61 chroot $MOUNT ./action/go
       
    62 
       
    63 
       
    64 #cat $BACKING/action/results
       
    65 
       
    66 #rm -rf build/env
       
    67