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 "Debian pristine image not found, try running create-source-image" |
|
13 echo $PRISTINE |
|
14 exit -1 |
|
15 fi |
|
16 |
|
17 TOPDIR=`pwd` |
|
18 mkdir -p $TOPDIR/build/env |
|
19 BACKING=$TOPDIR/build/env/backing |
|
20 MOUNT=$TOPDIR/build/env/mount |
|
21 if [ -e $MOUNT ] ; then |
|
22 echo "Removing old filesystem" |
|
23 # FIXME: evil hack! |
|
24 chroot $MOUNT /etc/init.d/ssh stop || true |
|
25 umount $MOUNT/proc || true |
|
26 umount $MOUNT || true |
|
27 rm -rf $MOUNT |
|
28 fi |
|
29 if [ -e $BACKING ] ; then |
|
30 echo "Copying deb files into cache" |
|
31 cp $BACKING/var/cache/apt/archives/* build/aptcache/$DEBVERSION || true |
|
32 echo "Deleting old filesystem backing store" |
|
33 rm -rf $BACKING |
|
34 fi |
|
35 mkdir $BACKING $MOUNT |
|
36 |
|
37 touch $BACKING/please-trash-this-system |
|
38 mkdir -p $BACKING/etc |
|
39 echo "pristine" > $BACKING/etc/debian_chroot |
|
40 cp -v policy-rc.d $BACKING/etc/policy-rc.d |
|
41 |
|
42 mkdir -p $BACKING/var/cache/apt/archives |
|
43 echo "Copying deb files out of cache" |
|
44 cp build/aptcache/$DEBVERSION/* $BACKING/var/cache/apt/archives || true |
|
45 |
|
46 cp -av action $BACKING |
|
47 #hg -R ../mercurial-server archive -r default $BACKING/action/mercurial-server |
|
48 ( cd ../mercurial-server && \ |
|
49 hg st -mac0n | cpio -p -0 -d $BACKING/action/mercurial-server ) |
|
50 |
|
51 #cp ../mercurial-server/build/debian/mercurial-server_1.0-1_all.deb $BACKING/action |
|
52 |
|
53 unionfs-fuse -o cow -o allow_other,suid,dev $BACKING=RW:$PRISTINE=RO $MOUNT |
|
54 |
|
55 #mount --bind /dev "$MOUNT/dev" |
|
56 #mount --bind /dev/pts "$MOUNT/dev/pts" |
|
57 mount -t proc proc $MOUNT/proc |
|
58 |
|
59 chroot $MOUNT ./action/go |
|
60 |
|
61 |
|
62 #cat $BACKING/action/results |
|
63 |
|
64 #rm -rf build/env |
|
65 |
|