+# GPG keys are installed in /etc/pki/rpm-gpg by both the Boot Manager
+# during initial installation, and by PlanetLabConf during daily
+# updates. NodeUpdate imports the keys into the RPM database before
+# running yum daily. vserver-reference copies and imports the keys
+# into the reference images and system slices daily. The only parts of
+# this process that are actually necessary, are the Boot Manager and
+# vserver-reference. However, we do not want to force a re-install of
+# all nodes, and we do not want to force an update of
+# vserver-reference, so in the meantime, PlanetLabConf and NodeUpdate
+# take care of getting the keys installed and imported in /, and this
+# script takes care of getting them installed in the reference images
+# and system slices, until we can get a new vserver-reference image
+# pushed out.
+update_vserver_reference() {
+ echo "* Updating VServer reference"
+
+ shopt -s nullglob
+
+ VROOTS="/vservers/vserver-reference /vservers/.vcache/* /vservers/${PLC_SLICE_PREFIX}_*"
+
+ # 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/* \
+ /etc/pki/rpm-gpg/* ; do
+ if [ -r $file ] ; then
+ for vroot in $VROOTS ; do
+ install -D -m 644 $file $vroot/$file
+ done
+ fi
+ done
+
+ # (Re)install GPG signing keys
+ if [ -d /etc/pki/rpm-gpg ] ; then
+ for vroot in $VROOTS ; do
+ chroot $vroot rpm --allmatches -e gpg-pubkey || :
+ chroot $vroot rpm --import /etc/pki/rpm-gpg/* || :
+ done
+ fi
+}
+