chiark / gitweb /
reorg source
[hippotat.git] / uml / psusan-uml-inside
1 #!/bin/bash
2 # Copyright 2021 Ian Jackson, Simon Tatham, and contributors to Hippotat
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 # There is NO WARRANTY.
5
6 set -ex
7
8 mkdir /dev/pts
9 mount -t proc none /proc
10 mount -t sysfs none /sys
11 mount -t devpts none /dev/pts
12 mount -t tmpfs none /tmp
13 mount -t tmpfs none /run
14
15 mount --bind /usr/lib/uml/modules/ /lib/modules/   
16 modprobe tun
17
18 exec 0<>/dev/tty1 1>&0
19 stty raw -echo
20
21 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991959
22 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
23 export PATH
24 export SHELL=/bin/bash
25
26 HOME=$(cat /proc/cmdline)
27 case "$HOME" in
28 *' psusan-uml-tmp='*) ;;
29 *) echo >&2 'psusan-uml-tmp not found in /proc/cmdline'; exit 1;;
30 esac
31 HOME=${HOME##* psusan-uml-tmp=}
32 HOME=${HOME%% *}
33 export HOME
34 cd "$HOME"
35
36 dd if=random-seed of=/dev/urandom
37 src/uml/rndaddtoentcnt/rndaddtoentcnt 4096 >&2
38
39 exec psusan