+####################
+#
+# (*) sometimes we have yum issuing errors like 'package does not match intended content'
+# this means that the sha256 checksum of the downloaded pkg does not match
+# the sha256 checksum advertised in filelists.xml
+# if you did run 'yum clean all' on the node,
+# this means that the repodata/ dir. on the server side is out of date
+# forcing a createrepo should solve this
+#
+# (*) also sometimes the node complains that a package is not signed
+#
+# so there quite obviously are some corner cases that are not well handled
+# hopefully the following subforms may be helpful to recover in these cases
+#
+# /etc/plc.d/packages clean
+# performs cleanup of the yum repositories and signed-stamps
+# thus forcing the next 'start' command to re-sign and re-index everything
+# /etc/plc.d/packages superclean
+# like 'clean', plus this will reinstall the noderepo rpms that you have,
+# that is to say restart from unsigned rpms
+# /etc/plc.d/packages start
+# this is the usual form, it should be smart enough to only sign the packages that need to,
+# and to rerun createrepo when useful
+# /etc/plc.d/packages force
+# same as 'start' but createrepo is run unconditionnally
+#
+# PS. I suspect sometimes the signing fails and the script does not notice properly
+####################
+
+
+# helper for hacking yumgroups
+# if we've installed for several flavours
+# we create cross links in install-rpms like this one
+# ./onelab-f8-i386/sliceimage-onelab-f12-i386-5.0-6.2011.02.03.i686.rpm
+# -> /var/www/html/install-rpms/onelab-f12-i386/sliceimage-onelab-f12-i386-5.0-6.2011.02.03.i686.rpm
+#
+# but this won't make it to the nodes until they are insered in yumgroups.xml in the PlanetLab group
+#
+
+function hack_yumgroups () {
+ repo=$1; shift
+
+ pushd $repo >& /dev/null
+ pwd
+ sirpms=$(find . -name 'sliceimage*rpm')
+ echo found sirpms $sirpms
+ if [ ! -f yumgroups.xml ] ; then
+ echo "hack_yumgroups: could not find yumgroups in $(pwd)"
+ elif [ -z "$sirpms" ] ; then
+ echo "No need to hack yumgroups, no foreign sliceimage package found"
+ else
+ cp yumgroups.xml yumgroups.xml.hacking
+ # remove references to package sliceimage-
+ grep -v '>sliceimage-' yumgroups.xml.hacking > yumgroups.xml
+ # build a list of lines with corresponding rpm names
+ insert=""
+ for sirpm in $sirpms; do
+ rpmname=$(rpm -q --qf '%{name}' -p $sirpm)
+ echo found file $sirpm with name $rpmname
+ insert="$insert<packagereq type=\"mandatory\">$rpmname</packagereq>"
+ done
+ echo 'inserting' $insert
+ # insert in yumgroups at the right place -- first packages in the PlanetLab group
+ ed yumgroups.xml <<EOF
+1
+/name>PlanetLab<
+/packagelist
++
+i
+$insert
+.
+w
+q
+EOF
+ fi
+ popd >& /dev/null
+}
+
+####################