Misc fixes. allow to use a .settings file to configure startup.sh

This commit is contained in:
Kees Jongenburger
2012-06-08 10:41:03 +02:00
parent 207f5bd024
commit 2771e8e77e
2 changed files with 19 additions and 11 deletions

View File

@@ -15,9 +15,10 @@ Things that still need doing by hand:
* copy ssh shared key
* Create .ssh/config
Host gitsrv
HosstName oeeo.few.vu.nl
HostName oeeo.few.vu.nl
User git
IdentityFile ~/.ssh/shared
IdentityFile ~/.ssh/minix-root-shared
* git config --global user.name "Kees Jongenburger"
* git config --global user.email "kees.jongenburger@gmail.com"
* create dot git config and addremote git@gitsrv:minix-usb

View File

@@ -1,10 +1,15 @@
#!/bin/sh
if [ ! -f minix.postinst.8g.img ]
then
minix.postinst.8g.img
fi
DISK_IMAGE=minix.postinst.8g.img
INSTANCE_NUMBER=1
if [ -f .settings ]
then
#allow to override the above settings using a .settings file
#with DISK_IMAGE=minix-usb.img for example
. ./.settings
fi
if [ ! -f usbdisk.img ]
then
@@ -17,19 +22,22 @@ USB_DISK_PARAMS="-drive id=my_usb_disk,file=usbdisk.img,if=none -device usb-sto
QEMU_PARAMS=$USB_DISK_PARAMS
INSTANCE_NUMBER=1
for i in `seq 1 1 10`
for i in `seq 0 1 10`
do
if ! netstat -na | grep "tcp[^6].*LISTEN" | awk '{print $4}' | sed "s,.*:,,g" | grep $((4444 + $i)) 1>/dev/null
then
echo "Free instance found: $i"
INSTANCE_NUMBER=$i
break
fi
done
if [ ! -f $DISK_IMAGE ]
then
echo "Did not find '${DISK_IMAGE}' to start"
exit 1
fi
SSH_PORT=$((2222 + $INSTANCE_NUMBER))
MONITOR_PORT=$((4444 + $INSTANCE_NUMBER))
@@ -39,9 +47,8 @@ MONITOR_PORT=$((4444 + $INSTANCE_NUMBER))
#
# start qemu with port redirection so sshing to localhost 2222 will ssh into the qemu instance
# also start the monitor on port 4444 so we can telnet to it.
echo "starting qemu instance ${INSTANCE_NUMBER} with ssh port ${SSH_PORT} and monitor on port ${MONITOR_PORT}"
echo "starting ${DISK_IMAGE} qemu instance ${INSTANCE_NUMBER} with ssh port ${SSH_PORT} and monitor on port ${MONITOR_PORT}"
sleep 2
exit
qemu-system-i386 -localtime -redir tcp:$SSH_PORT::22 -m 1024 -hda $DISK_IMAGE -curses \
-monitor telnet::$MONITOR_PORT,server,nowait \
-enable-kvm -usb $QEMU_PARAMS