#!/bin/bash # # vserver-reference Updates VServer reference # # Load before pl_conf, pl_nm, vcached, and vservers # chkconfig: 3 60 80 # description: Builds VServer reference image # # Mark Huang # Copyright (C) 2004 The Trustees of Princeton University # # $Id$ # case "$1" in start|restart|reload) ;; stop|status) exit 0 ;; *) echo $"Usage: $0 {start|stop|restart|status}" exit 1 ;; esac # Source function library. . /etc/init.d/functions # VServer definitions . /usr/lib/util-vserver/util-vserver-vars # Save stdout and stderr exec 3>&1 exec 4>&2 # Redirect stdout and stderr to a log file exec 2>&1 exec &>/var/log/vserver-reference.log echo -n $"Updating VServer reference: " >&3 2>&4 shopt -s nullglob VROOTS="$__DEFAULT_VSERVERDIR/vserver-reference $__DEFAULT_VSERVERDIR/.vcache/*" # Make sure the barrier bit is set chmod 0000 /vservers setattr --barrier /vservers # Copy configuration files from host to slices for file in /etc/hosts /etc/resolv.conf /etc/yum.conf /etc/planetlab/node_id \ /etc/planetlab/plc_config* /etc/planetlab/php/* ; do if [ -r $file ] ; then for vroot in $VROOTS ; do if [ -f $vroot/etc/AUTO_UPDATE_NET_FILES ] ; then install -D -m 644 $file $vroot/$file fi done fi done # Parse PLC configuration if [ -r /etc/planetlab/plc_config ] ; then . /etc/planetlab/plc_config else PLC_NAME="PlanetLab" PLC_BOOT_HOST="boot.planet-lab.org" PLC_BOOT_SSL_CRT="/etc/planetlab/boot_ssl.crt" fi CACERT=/mnt/cdrom/bootme/cacert/$PLC_BOOT_HOST/cacert.pem if [ -r $CACERT ] ; then for vroot in $VROOTS ; do # Install boot server certificate install -D -m 644 $CACERT $vroot/$PLC_BOOT_SSL_CRT # Also install in /mnt/cdrom/bootme for backward compatibility install -D -m 644 $CACERT $vroot/mnt/cdrom/bootme/cacert/$PLC_BOOT_HOST/cacert.pem echo $PLC_BOOT_HOST > $vroot/mnt/cdrom/bootme/BOOTSERVER done fi success >&3 2>&4 echo >&3 2>&4 exit 0