cryptonas-branches/translation-base-v0.4/bin/uml-setup.sh

38 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2008-04-08 01:08:43 +02:00
#!/bin/sh
PROJ_DIR=$(dirname "$0")/..
PROJ_DIR=$(cd "$PROJ_DIR"; pwd)
ROOT_IMG=$PROJ_DIR/bin/cryptobox.img
TEST_IMG=$PROJ_DIR/bin/test.img
TEST_SIZE=128
MEM_SIZE=128M
if test ! -e "$ROOT_IMG"
then echo "Could not find the cryptobox system image ($ROOT_IMG)"
echo " see stuff/uml-howto.txt for information on how to build a system image"
echo " store (or link) the result as '$ROOT_IMG'"
exit 1
fi
# Preparations:
# echo "tun" >>/etc/modules
# follow the instructions in /usr/share/doc/uml-utilities/README.Debian
# add your user to the group 'uml-net'
#
/sbin/ifconfig tap0 &>/dev/null || { echo "tap0 is not configured - read /usr/share/doc/uml-utilities/README.Debian for hints"; exit 1; }
if [ ! -e "$TEST_IMG" ]
then echo "Creating testing image file ..."
dd if=/dev/zero of="$TEST_IMG" bs=1M count=$TEST_SIZE
fi
if [ ! -w "$ROOT_IMG" ]; then
echo "Make sure \"${ROOT_IMG}\" exists and is writeable"
exit 1;
fi
# "aio=2.4" is necessary, as otherwise sfdiks hangs at "nanosleep({3,0})"
linux ubd0="$ROOT_IMG" ubd1="$TEST_IMG" con=xterm hostfs=$PROJ_DIR fakehd eth0=daemon mem=$MEM_SIZE aio=2.4