Debian Codegraph @

tests/uml-guest-init

raw
1 #!/bin/sh
2 set -e -u -x
3
4 export PATH=/usr/sbin:/usr/bin:/sbin:/bin
5
6 mount_stuff()
7 {
8 mount -n -t proc proc /proc
9 mount -n -t sysfs sysfs /sys
10 mkdir -p /dev/pts
11 mount -n -t devpts devpts /dev/pts
12 mount -n -o bind /usr/lib/uml/modules /lib/modules
13 mount -n -t tmpfs tmpfs /tmp -o size=1G
14 }
15
16 if [ "$1" != '--cow' ]
17 then
18 export testdir="$(printf '%s' "$1" | tr _ = | base64 -d)"
19 export testfile="$(printf '%s' "$2" | tr _ = | base64 -d)"
20 mount_stuff
21 mkdir -m 0700 /tmp/dev
22 mknod /tmp/dev/ubda b 98 0
23 mkswap -f /tmp/dev/ubda
24 swapon /tmp/dev/ubda
25 mkdir -m 0700 /tmp/ro /tmp/rw /tmp/aufs
26 mount -n -t hostfs hostfs /tmp/ro -o /,ro
27 mount -n -t aufs aufs /tmp/aufs -o noatime,noxino,dirs=/tmp/rw:/tmp/ro=ro
28 exec chroot /tmp/aufs "$0" --cow
29 else
30 mount_stuff
31 rm -vf \
32 /var/lib/adequate/* \
33 /var/lib/dpkg/lock \
34 /var/lib/dpkg/triggers/Lock \
35 /var/lib/apt/listchanges.db \
36 /var/log/apt/term.log \
37 /var/log/apt/history.log \
38 /var/log/dpkg.log \
39 /var/cache/apt/archives/lock \
40 /var/cache/debconf/*.dat
41 cd "$testdir"
42 ./run-tests "$testfile"
43 halt -f
44 fi
45
46 # vim:ts=4 sts=4 sw=4 et