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