xentaur

changeset 43:61476759b5f1

build fixes
author igor
date Wed Oct 24 14:30:08 2007 +0300 (2007-10-24)
parents e006fac33f05
children 04f0c6694d1e
files build-xenomips-image files/xenomips-init
line diff
     1.1 --- a/build-xenomips-image	Wed Oct 24 13:27:53 2007 +0300
     1.2 +++ b/build-xenomips-image	Wed Oct 24 14:30:08 2007 +0300
     1.3 @@ -1,9 +1,9 @@
     1.4  #!/bin/sh
     1.5  
     1.6  DYNAMIPS_BUILD=no
     1.7 -XENOMIPS_FS_BUILD=yes
     1.8 +XENOMIPS_FS_BUILD=no
     1.9  CONFIG_FS_BUILD=yes
    1.10 -IOS_FS_BUILD=yes
    1.11 +IOS_FS_BUILD=no
    1.12  
    1.13  XENOMIPS_DIR="files/"
    1.14  XENOMIPS_IMAGES_DIR="/xen/images/"
    1.15 @@ -17,7 +17,7 @@
    1.16  # Config FS
    1.17  CONFIG_FS_SIZE=1000k
    1.18  CONFIG_FS_NAME=${XENOMIPS_IMAGES_DIR}/xenomips-configXXX.img  # XXX will be automagically substitued with 
    1.19 -CONFIG_FS_NUMBER=5                                            # the number of the Xenomips instance
    1.20 +CONFIG_FS_NUMBER=10                                           # the number of the Xenomips instance
    1.21  
    1.22  # IOS FS
    1.23  IOS_FS_SIZE=2048k
    1.24 @@ -63,13 +63,23 @@
    1.25      cd ${OLD_PWD}
    1.26  }
    1.27  
    1.28 -myecho Preparing the Xenomips filesystem
    1.29 -dd if=/dev/zero of=${XENOMIPS_FS_NAME} seek=${XENOMIPS_FS_SIZE} bs=1024 count=1
    1.30 -mkfs.ext3 -F ${XENOMIPS_FS_NAME}
    1.31 -mkdir -p ${WORK_DIR} ${WORK_DIR2}
    1.32 -mount -o loop ${XENOMIPS_FS_NAME} ${WORK_DIR}
    1.33 -debootstrap  ${DISTRO} ${WORK_DIR} ${DEBIAN_MIRROR} 
    1.34 -cat <<SCRIPT | chroot ${WORK_DIR} sh -s
    1.35 +if [ $(id -u) != 0 ]
    1.36 +then
    1.37 +    echo You are not root.
    1.38 +    echo Please, log in as root or run the script with sudo
    1.39 +    ecit 1
    1.40 +fi
    1.41 +
    1.42 +
    1.43 +if  echo $XENOMIPS_FS_BUILD | grep -qi ^y
    1.44 +then
    1.45 +    myecho Preparing the Xenomips filesystem
    1.46 +    dd if=/dev/zero of=${XENOMIPS_FS_NAME} seek=${XENOMIPS_FS_SIZE} bs=1024 count=1
    1.47 +    mkfs.ext3 -F ${XENOMIPS_FS_NAME}
    1.48 +    mkdir -p ${WORK_DIR}
    1.49 +    mount -o loop ${XENOMIPS_FS_NAME} ${WORK_DIR}
    1.50 +    debootstrap  ${DISTRO} ${WORK_DIR} ${DEBIAN_MIRROR} 
    1.51 +    cat <<SCRIPT | chroot ${WORK_DIR} sh -s
    1.52  unset LANG
    1.53  apt-get -y --force-yes install ${PACKAGES}
    1.54  /etc/init.d/ssh stop
    1.55 @@ -112,27 +122,33 @@
    1.56  PROFILE
    1.57  SCRIPT
    1.58  
    1.59 -for kernel_version in ${KERNEL_VERSION} 2.6.18-without-PAE-4-xen-686
    1.60 -do
    1.61 -    cp -R /lib/modules/${KERNEL_VERSION} ${WORK_DIR}/lib/modules
    1.62 -done
    1.63 +    for kernel_version in ${KERNEL_VERSION} 2.6.18-without-PAE-4-xen-686
    1.64 +    do
    1.65 +        cp -R /lib/modules/${KERNEL_VERSION} ${WORK_DIR}/lib/modules
    1.66 +    done
    1.67  
    1.68 -cp ${XENOMIPS_DIR}/xenomips-init ${WORK_DIR}/etc/init.d/
    1.69 -cp ${XENOMIPS_DIR}/xenomips.sh ${WORK_DIR}/usr/local/bin
    1.70 -sudo chmod +x  ${WORK_DIR}/usr/local/bin/xenomips.sh ${WORK_DIR}/etc/init.d/xenomips-init
    1.71 +    cp ${XENOMIPS_DIR}/xenomips-init ${WORK_DIR}/etc/init.d/
    1.72 +    cp ${XENOMIPS_DIR}/xenomips.sh ${WORK_DIR}/usr/local/bin
    1.73 +    sudo chmod +x  ${WORK_DIR}/usr/local/bin/xenomips.sh ${WORK_DIR}/etc/init.d/xenomips-init
    1.74  
    1.75 -cat ${SSH_OPEN_KEY} > ${WORK_DIR}/root/.ssh/authorized_keys
    1.76 -chmod 600  ${WORK_DIR}/root/.ssh/authorized_keys
    1.77 +    cat ${SSH_OPEN_KEY} > ${WORK_DIR}/root/.ssh/authorized_keys
    1.78 +    chmod 600  ${WORK_DIR}/root/.ssh/authorized_keys
    1.79  
    1.80 -build_and_install_dynamips
    1.81 +    build_and_install_dynamips
    1.82 +    umount ${WORK_DIR}
    1.83 +fi
    1.84  
    1.85 -mv ${WORK_DIR}/etc/quagga.ORIG ${WORK_DIR2}/quagga
    1.86 -perl -i -p -e 's/=no/=yes/' ${WORK_DIR2}/quagga/daemons
    1.87 -touch ${WORK_DIR2}/quagga/{zebra,bgpd,ospfd,ripd,ripngd,ospf6d,isisd}.conf
    1.88 -umount ${WORK_DIR}
    1.89  
    1.90  if  echo $CONFIG_FS_BUILD | grep -qi ^y
    1.91  then
    1.92 +    mkdir -p ${WORK_DIR}
    1.93 +    mount -o loop ${XENOMIPS_FS_NAME} ${WORK_DIR}
    1.94 +    mkdir -p ${WORK_DIR2}
    1.95 +    cp -a ${WORK_DIR}/etc/quagga.ORIG ${WORK_DIR2}/quagga
    1.96 +    perl -i -p -e 's/=no/=yes/' ${WORK_DIR2}/quagga/daemons
    1.97 +    touch ${WORK_DIR2}/quagga/{zebra,bgpd,ospfd,ripd,ripngd,ospf6d,isisd}.conf
    1.98 +    umount ${WORK_DIR}
    1.99 +
   1.100      myecho Preparing the Xenomips config filesystem
   1.101      dd if=/dev/zero of=${CONFIG_FS_NAME} bs=1k count=1 seek=${CONFIG_FS_SIZE} 
   1.102      mkfs.ext3 -F ${CONFIG_FS_NAME}
     2.1 --- a/files/xenomips-init	Wed Oct 24 13:27:53 2007 +0300
     2.2 +++ b/files/xenomips-init	Wed Oct 24 14:30:08 2007 +0300
     2.3 @@ -42,6 +42,17 @@
     2.4    touch /var/log/dmesg
     2.5  }
     2.6  
     2.7 +unbind_mounts() {
     2.8 +# FIXME
     2.9 +    true
    2.10 +}
    2.11  
    2.12 -bind_mounts
    2.13 +case $1 in
    2.14 +    start)
    2.15 +        bind_mounts
    2.16 +    ;;
    2.17 +    stop)
    2.18 +        unbind_mounts
    2.19 +    ;;
    2.20 +esac
    2.21