dev/chroot-test/run-test
branchdebian
changeset 284 85607df3fd19
parent 283 01eca64f77ab
child 308 e1f71a2eafb6
equal deleted inserted replaced
281:7d59a0f92c78 284:85607df3fd19
     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 
       
    44 SCRIPTS=dev/chroot-test
       
    45 
       
    46 cp -v $SCRIPTS/policy-rc.d $BACKING/etc/policy-rc.d
    43 
    47 
    44 mkdir -p $BACKING/var/cache/apt/archives
    48 mkdir -p $BACKING/var/cache/apt/archives
    45 echo "Copying deb files out of cache"
    49 echo "Copying deb files out of cache"
    46 cp build/aptcache/$DEBVERSION/* $BACKING/var/cache/apt/archives || true
    50 cp $BUILDDIR/aptcache/$DEBVERSION/* $BACKING/var/cache/apt/archives || true
    47 
    51 
    48 cp -av action $BACKING
    52 cp -av $SCRIPTS/action $BACKING
    49 #hg -R ../mercurial-server archive -r default $BACKING/action/mercurial-server
    53 . $SCRIPTS/copy-installables
    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 
    54 
    55 unionfs-fuse -o cow -o allow_other,suid,dev $BACKING=RW:$PRISTINE=RO $MOUNT
    55 unionfs-fuse -o cow -o allow_other,suid,dev $BACKING=RW:$PRISTINE=RO $MOUNT
    56 
    56 
    57 #mount --bind /dev "$MOUNT/dev"
    57 #mount --bind /dev "$MOUNT/dev"
    58 #mount --bind /dev/pts "$MOUNT/dev/pts"
    58 #mount --bind /dev/pts "$MOUNT/dev/pts"
    59 mount -t proc proc $MOUNT/proc
    59 mount -t proc proc $MOUNT/proc
    60 
    60 
    61 chroot $MOUNT ./action/go
    61 chroot $MOUNT ./action/go
    62 
    62 
    63 
       
    64 #cat $BACKING/action/results
       
    65 
       
    66 #rm -rf build/env
       
    67