# HG changeset patch # User Rob Landley # Date 1231370152 21600 # Node ID 0b384865cf0c8310b1873cd3b998e070a2611119 # Parent 128b3b0700bf49e9bec9ed2e58e312bb240104f5 Make the init script care about PID rather than script name for determining qemu vs chroot invocation. diff -r 128b3b0700bf -r 0b384865cf0c sources/native/bin/qemu-setup.sh --- a/sources/native/bin/qemu-setup.sh Mon Jan 05 21:23:45 2009 -0600 +++ b/sources/native/bin/qemu-setup.sh Wed Jan 07 17:15:52 2009 -0600 @@ -14,6 +14,7 @@ [ -z "$PATH" ] && PATH=/tools/bin || PATH="$PATH":/tools/bin export PATH fi +export HOME=/home # Create some temporary directories at the root level mkdir -p {proc,sys,dev,etc,tmp,home} @@ -30,7 +31,7 @@ mountpoint -q proc || mount -t proc proc proc # If we're running under qemu, do some more setup -if [ `echo $0 | sed 's@.*/@@'` == "qemu-setup.sh" ] +if [ $$ -eq 1 ] then # Note that 10.0.2.2 forwards to 127.0.0.1 on the host. @@ -51,16 +52,17 @@ then mount $HOMEDEV /home fi + + echo Type exit when done. + exec /tools/bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /tools/bin/ash + +# If we're not PID 1, it's probably a chroot. else echo "nameserver 4.2.2.1" > /etc/resolv.conf -fi -export HOME=/home -echo Type exit when done. + # Switch to a shell with command history. -# Switch to a shell with command history. -if [ $$ -ne 1 ] -then + echo Type exit when done. /tools/bin/ash cd / umount ./dev @@ -68,6 +70,4 @@ umount ./sys umount ./proc sync -else - exec /tools/bin/oneit -c /dev/"$(dmesg | sed -n '/^Kernel command line:/s@.* console=\(/dev/\)*\([^ ]*\).*@\2@p')" /tools/bin/ash fi