3 # vserver-reference Updates VServer reference
5 # Load before pl_conf, pl_nm, vcached, and vservers
7 # description: Builds VServer reference image
9 # Mark Huang <mlhuang@cs.princeton.edu>
10 # Copyright (C) 2004 The Trustees of Princeton University
22 echo $"Usage: $0 {start|stop|restart|status}"
27 # Source function library.
28 . /etc/init.d/functions
31 . /usr/lib/util-vserver/util-vserver-vars
33 # Parse PLC configuration
34 if [ -r /etc/planetlab/plc_config ] ; then
35 . /etc/planetlab/plc_config
39 PLC_BOOT_HOST="boot.planet-lab.org"
42 # Save stdout and stderr
46 # Redirect stdout and stderr to a log file
48 exec &>/var/log/vserver-reference.log
50 echo -n $"Updating VServer reference: " >&3 2>&4
54 VROOTS="$__DEFAULT_VSERVERDIR/vserver-reference $__DEFAULT_VSERVERDIR/.vcache/* $__DEFAULT_VSERVERDIR/${PLC_SLICE_PREFIX}_*"
56 # Make sure the barrier bit is set
58 setattr --barrier /vservers
60 # Copy configuration files from host to slices
61 for file in /etc/hosts /etc/resolv.conf /etc/yum.conf /etc/planetlab/node_id \
62 /etc/planetlab/plc_config* /etc/planetlab/php/* \
63 /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora \
64 /etc/pki/rpm-gpg/RPM-GPG-KEY-planetlab ; do
65 if [ -r $file ] ; then
66 for vroot in $VROOTS ; do
67 if [ "$(dirname $file)" = "/etc/pki/rpm-gpg" -a \
68 ! -f $vroot/$file ] ; then
73 install -D -m 644 $file $vroot/$file
74 if [ $import -eq 1 ] ; then
75 chroot $vroot rpm --import $file
81 # Old versions of the Boot Manager copied portions of the Boot CD to
82 # /mnt/cdrom/bootme, to support old scripts which assumed that the
83 # Boot CD was mounted even in production mode. Now, it just copies it
84 # to /usr/boot/cacert.pem. In any case, copy the boot server
85 # certificate to the place(s) where BootServerRequest expects to find
86 # it (/usr/boot/cacert.pem by default, /mnt/cdrom/bootme in old
88 CACERT="/usr/boot/cacert.pem /mnt/cdrom/bootme/cacert/$PLC_BOOT_HOST/cacert.pem"
89 for cacert in $CACERT ; do
90 if [ -r $cacert ] ; then
91 for vroot in $VROOTS ; do
92 # Install boot server certificate
93 install -D -m 644 $cacert $vroot/usr/boot/cacert.pem
94 echo $PLC_BOOT_HOST > $vroot/usr/boot/boot_server
96 # Also install in /mnt/cdrom/bootme for backward compatibility
97 install -D -m 644 $cacert $vroot/mnt/cdrom/bootme/cacert/$PLC_BOOT_HOST/cacert.pem
98 echo $PLC_BOOT_HOST > $vroot/mnt/cdrom/bootme/BOOTSERVER