xentaur
changeset 7:825cd93472de
Dodelal
author | igor |
---|---|
date | Thu Aug 02 20:46:09 2007 +0300 (2007-08-02) |
parents | e4d8da085a2e |
children | 88a212771d27 |
files | build-xenomips-image files/xenomips.sh xentaur.py |
line diff
1.1 --- a/build-xenomips-image Sun Jul 15 14:37:16 2007 +0300 1.2 +++ b/build-xenomips-image Thu Aug 02 20:46:09 2007 +0300 1.3 @@ -2,24 +2,23 @@ 1.4 1.5 DYNAMIPS_BUILD=yes 1.6 XENOMIPS_FS_BUILD=yes 1.7 -CONFIG_FS_BUILD=no 1.8 +CONFIG_FS_BUILD=yes 1.9 IOS_FS_BUILD=yes 1.10 1.11 +XENOMIPS_DIR="files/" 1.12 +XENOMIPS_IMAGES_DIR="../images/" 1.13 + 1.14 #Xenomips FS 1.15 XENOMIPS_FS_SIZE=2048k # size in 1k blocks 1.16 -XENOMIPS_FS_NAME=xenomips1.img 1.17 +XENOMIPS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips1.img 1.18 1.19 # Config FS 1.20 -CONFIG_FS_SIZE=100k 1.21 -CONFIG_FS_NAME=xenomips-config1.img 1.22 +CONFIG_FS_SIZE=1000k 1.23 +CONFIG_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-config1.img 1.24 1.25 # IOS FS 1.26 IOS_FS_SIZE=2048k 1.27 -IOS_FS_NAME=xenomips-ios1.img 1.28 - 1.29 - 1.30 -XENOMIPS_DIR="files/" 1.31 - 1.32 +IOS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-ios1.img 1.33 1.34 DEBIAN_MIRROR=http://debian.org.ua/debian 1.35 DISTRO=sid 1.36 @@ -32,6 +31,7 @@ 1.37 IOS_DIR="ios/" 1.38 1.39 WORK_DIR=${XENOMIPS_FS_NAME%%.img} 1.40 +WORK_DIR2=/tmp/xenomips-build 1.41 1.42 build_and_install_dynamips() 1.43 { 1.44 @@ -58,7 +58,7 @@ 1.45 1.46 dd if=/dev/zero of=${XENOMIPS_FS_NAME} count=${XENOMIPS_FS_SIZE} bs=1024 1.47 mkfs.ext3 -F ${XENOMIPS_FS_NAME} 1.48 -mkdir -p ${WORK_DIR} 1.49 +mkdir -p ${WORK_DIR} ${WORK_DIR2} 1.50 mount -o loop ${XENOMIPS_FS_NAME} ${WORK_DIR} 1.51 debootstrap ${DISTRO} ${WORK_DIR} ${DEBIAN_MIRROR} 1.52 cat <<SCRIPT | chroot ${WORK_DIR} sh -s 1.53 @@ -85,11 +85,16 @@ 1.54 cd /etc/rcS.d; ln -s ../init.d/xenomips-init S35xenomips-init 1.55 rm /etc/rc2.d/S*quagga 1.56 1.57 -perl -i -p -e s@C_PATH=/etc/quagga@C_PATH=/xenomips/etc/quagga@ /etc/init.d/quagga 1.58 +#perl -i -p -e s@C_PATH=/etc/quagga@C_PATH=/xenomips/etc/quagga@ /etc/init.d/quagga 1.59 +mv /etc/quagga /etc/quagga.ORIG 1.60 +ln -s /xenomips/config/etc/quagga /etc/quagga 1.61 1.62 -mkdir -p /xenomips/{ios,config,dynamips,etc/quagga} /var/lib/xenomips /root/.ssh 1.63 +mkdir -p /xenomips/{ios,config,dynamips} /var/lib/xenomips /root/.ssh 1.64 1.65 +cat <<PROFILE >> /root/.profile 1.66 +TERM=linux 1.67 screen -ls | grep -q Attached && screen -x || screen -ls | grep -q Detached && screen -r 1.68 +PROFILE 1.69 SCRIPT 1.70 1.71 cp -R /lib/modules/${KERNEL_VERSION} ${WORK_DIR}/lib/modules 1.72 @@ -103,6 +108,7 @@ 1.73 1.74 build_and_install_dynamips 1.75 1.76 +mv ${WORK_DIR}/etc/quagga ${WORK_DIR2} 1.77 umount ${WORK_DIR} 1.78 1.79 if echo $CONFIG_FS_BUILD | grep -qi ^y 1.80 @@ -111,6 +117,9 @@ 1.81 mkfs.ext3 -F ${CONFIG_FS_NAME} 1.82 fi 1.83 1.84 +mount -o loop ${CONFIG_FS_NAME} ${WORK_DIR} 1.85 +mkdir -p ${WORK_DIR}/etc 1.86 +mv ${WORK_DIR2}/quagga ${WORK_DIR}/etc 1.87 1.88 if echo $IOS_FS_BUILD | grep -qi ^y 1.89 then
2.1 --- a/files/xenomips.sh Sun Jul 15 14:37:16 2007 +0300 2.2 +++ b/files/xenomips.sh Thu Aug 02 20:46:09 2007 +0300 2.3 @@ -1,9 +1,13 @@ 2.4 #!/bin/sh 2.5 2.6 -DYNAMIPS_WORKDIR="/xenomips/config" 2.7 -DYNAMIPS_ARGS=`cat /proc/cmdline | sed 's/.*xenomips="//; s/".*//'` 2.8 +if grep -qi xenomips /proc/cmdline 2.9 +then 2.10 + DYNAMIPS_WORKDIR="/xenomips/config" 2.11 + DYNAMIPS_ARGS=`cat /proc/cmdline | sed 's/.*xenomips="//; s/".*//'` 2.12 + cd "$DYNAMIPS_WORKDIR" 2.13 + screen -e '^xx' -d -m dynamips $DYNAMIPS_ARGS 2.14 +else 2.15 + /etc/init.d/quagga start 2.16 + screen -e '^xx' -d -m vtysh 2.17 +fi 2.18 2.19 - 2.20 -cd "$DYNAMIPS_WORKDIR" 2.21 -screen -e '^``' -d -m dynamips $DYNAMIPS_ARGS 2.22 -
3.1 --- a/xentaur.py Sun Jul 15 14:37:16 2007 +0300 3.2 +++ b/xentaur.py Thu Aug 02 20:46:09 2007 +0300 3.3 @@ -32,11 +32,12 @@ 3.4 3.5 def create_screens_script(): 3.6 3.7 - N=0 3.8 + N=1 3.9 screens=[] 3.10 for domain in domains: 3.11 - ip="192.168.80."+str(200+N) 3.12 - screens.append("screen -t "+domain+" "+str(N)+" sh -c 'while true; do ssh root@"+ip+" ; done'") 3.13 + screens.append("screen -t "+domain+" "+str(N)+" xm console "+domain) 3.14 +# ip="192.168.80."+str(200+N) 3.15 +# screens.append("screen -t "+domain+" "+str(N)+" sh -c 'while true; do ssh root@"+ip+" ; done'") 3.16 N+=1 3.17 screenlist="\n".join(screens) 3.18