xentaur

view files/xenomips.sh @ 68:f652fab38c7a

ec2 parameters small fixes
author Igor Chubin <igor@chub.in>
date Mon Jan 11 19:36:56 2010 +0200 (2010-01-11)
parents 6471afbee150
children
line source
1 #!/bin/sh
3 XENOMIPS=''
4 grep -qi xenomips /proc/cmdline && XENOMIPS=`cat /proc/cmdline | sed 's/.*xenomips="//; s/".*//'`
6 case $1 in
7 start)
8 [ -e /dev/hvc0 ] || ln -s /dev/null /dev/hvc0
9 if grep -qi xenomips /proc/cmdline
10 then
11 WORKDIR="/xenomips/config/dynamips"
12 if echo $XENOMIPS | grep -q ^./pemu
13 then
14 WORKDIR="/xenomips/config/pixemu"
15 PIXOS=`echo $XENOMIPS | sed 's/.* //'`
16 XENOMIPS=`echo $XENOMIPS | sed 's/ [^ ]*$//'`
17 cp /xenomips/config/pixemu/pemu.ini.ORIG /xenomips/config/pixemu/pemu.ini
18 sed -i -e "s@FLASH@$PIXOS@" /xenomips/config/pixemu/pemu.ini
19 fi
20 cd "$WORKDIR"
21 screen -e '^xx' -d -m sh -c "while true; do $XENOMIPS ; done"
22 else
23 /etc/init.d/quagga start
24 screen -e '^xx' -d -m sh -c 'while true; do vtysh; done'
25 fi
26 ;;
27 stop)
28 if grep -qi xenomips /proc/cmdline
29 then
30 kill $(ps aux | egrep "pemu|dynamips" | awk '{print $2}')
31 else
32 /etc/init.d/quagga stop
33 fi
34 ;;
35 esac