igor@0: #!/bin/sh igor@0: nata@31: DYNAMIPS_BUILD=no igor@43: XENOMIPS_FS_BUILD=no igor@41: CONFIG_FS_BUILD=yes igor@43: IOS_FS_BUILD=no igor@0: igor@7: XENOMIPS_DIR="files/" igor@40: XENOMIPS_IMAGES_DIR="/xen/images/" igor@40: IOS_DIR="ios/" igor@15: SSH_OPEN_KEY=files/id_dsa.pub igor@7: igor@0: #Xenomips FS igor@0: XENOMIPS_FS_SIZE=2048k # size in 1k blocks igor@7: XENOMIPS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips1.img igor@0: igor@0: # Config FS igor@7: CONFIG_FS_SIZE=1000k igor@18: CONFIG_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-configXXX.img # XXX will be automagically substitued with igor@43: CONFIG_FS_NUMBER=10 # the number of the Xenomips instance igor@0: igor@0: # IOS FS igor@0: IOS_FS_SIZE=2048k igor@7: IOS_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-ios1.img igor@0: igor@42: DEBIAN_MIRROR=ftp://debian.org.ua/debian igor@42: DISTRO=etch igor@41: PACKAGES="openssh-server libc6-xen libelf1 libpcap0.8 screen nfs-common quagga tcpdump telnet ntpdate hping3 openntpd" igor@0: DYNAMIPS_SOURCES=http://www.ipflow.utc.fr/dynamips/dynamips-0.2.7.tar.gz igor@0: DYNAMIPS_BUILD_DIR=dynamips/ igor@0: KERNEL_VERSION=`uname -r` igor@0: igor@0: igor@0: WORK_DIR=${XENOMIPS_FS_NAME%%.img} igor@7: WORK_DIR2=/tmp/xenomips-build igor@0: igor@17: myecho() igor@17: { igor@17: echo '**************************' igor@17: echo "$@" igor@17: echo '**************************' igor@17: } igor@17: igor@0: build_and_install_dynamips() igor@0: { igor@0: OLD_PWD="`pwd`" igor@20: DESTDIR=${WORK_DIR}/usr igor@0: igor@0: if echo $DYNAMIPS_BUILD | grep -qi ^y igor@0: then igor@0: rm -rf ${DYNAMIPS_BUILD_DIR}/ igor@0: mkdir -p ${DYNAMIPS_BUILD_DIR}/ igor@0: cd ${DYNAMIPS_BUILD_DIR}/ igor@0: wget $DYNAMIPS_SOURCES igor@0: tar xfz dynamips*tar* igor@0: cd dynamips*/ igor@0: perl -p -i -e s@^PCAP_LIB=.*@PCAP_LIB=-lpcap@ Makefile igor@0: make igor@0: else igor@0: cd ${DYNAMIPS_BUILD_DIR}/dynamips*/ igor@0: fi igor@20: make install DESTDIR=${DESTDIR} igor@0: cd ${OLD_PWD} igor@0: } igor@0: igor@43: if [ $(id -u) != 0 ] igor@43: then igor@43: echo You are not root. igor@43: echo Please, log in as root or run the script with sudo igor@43: ecit 1 igor@43: fi igor@43: igor@43: igor@43: if echo $XENOMIPS_FS_BUILD | grep -qi ^y igor@43: then igor@43: myecho Preparing the Xenomips filesystem igor@43: dd if=/dev/zero of=${XENOMIPS_FS_NAME} seek=${XENOMIPS_FS_SIZE} bs=1024 count=1 igor@43: mkfs.ext3 -F ${XENOMIPS_FS_NAME} igor@43: mkdir -p ${WORK_DIR} igor@43: mount -o loop ${XENOMIPS_FS_NAME} ${WORK_DIR} igor@43: debootstrap ${DISTRO} ${WORK_DIR} ${DEBIAN_MIRROR} igor@43: cat <