X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc.d%2Fpackages;h=77dcbf4656e313f33286dbef1afb231cab7bf803;hb=8701ed06737ebb5f3457a8768f01243865e3ed7a;hp=cd32f2b73594966f90d3ae338f4921eff54677cb;hpb=e1d0c8c4255d9425f0c1df5bf0d4e97e00a3a99c;p=bootstrapfs.git diff --git a/plc.d/packages b/plc.d/packages index cd32f2b..77dcbf4 100755 --- a/plc.d/packages +++ b/plc.d/packages @@ -16,11 +16,41 @@ # Be verbose set -x -#################### hack yumgroups +#################### +# +# (*) 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/vserver-onelab-f12-i386-5.0-6.2011.02.03.i686.rpm -# -> /var/www/html/install-rpms/onelab-f12-i386/vserver-onelab-f12-i386-5.0-6.2011.02.03.i686.rpm +# ./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 # @@ -30,21 +60,21 @@ function hack_yumgroups () { pushd $repo >& /dev/null pwd - vsrpms=$(find . -name 'vserver*rpm') - echo found vsrpms $vsrpms + 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 "$vsrpms" ] ; then - echo "No need to hack yumgroups, no foreign vserver package found" + 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 vserver- - grep -v '>vserver-' yumgroups.xml.hacking > yumgroups.xml + # remove references to package sliceimage- + grep -v '>sliceimage-' yumgroups.xml.hacking > yumgroups.xml # build a list of lines with corresponding rpm names insert="" - for vsrpm in $vsrpms; do - rpmname=$(rpm -q --qf '%{name}' -p $vsrpm) - echo found file $vsrpm with name $rpmname + for sirpm in $sirpms; do + rpmname=$(rpm -q --qf '%{name}' -p $sirpm) + echo found file $sirpm with name $rpmname insert="$insert$rpmname" done echo 'inserting' $insert @@ -64,15 +94,6 @@ EOF popd >& /dev/null } -#################### xxx fixme xxx -# I'm seeing weird things with f14 nodes and an f8 myplc server -# I suspect that the f8-based createrepo binary does not do the right thing, -# as the node (onelab09.pl.sophia.inria.fr) issues a lot of -# 'package does not match intended content' -# before reaching this conclusion I have entirely rebuilt the server-side yum repos -# by (*) checking the gpg keys (*) yum reinstalling all noderepos -# and on top of that manually re-running createrepo -# of course the node had gone through yum clean all as well #################### case "$1" in start|force) @@ -87,36 +108,46 @@ case "$1" in mode=$1; shift - if [[ -z "$@" ]] ; then - # use all subdirs in install-rpms by default - repositories=/var/www/html/install-rpms/* - else - # else use argv + # on PLC there is a need to select the repos as there are quite a few in there + # would contain names or patterns relative to install-rpms + explicit_list=/var/www/html/install-rpms/PACKAGES + + # use argv if provided + if [[ -n "$@" ]] ; then repositories="$@" + elif [ -f $explicit_list ] ; then + repositories="" + for name in $(grep -v '#' $explicit_list); do + repositories="$repositories /var/www/html/install-rpms/$name" + done + else + # use all subdirs in install-rpms by default + repositories=/var/www/html/install-rpms/* fi ########## - # deal with the vserver packages - # symlink all instances of plain 'vserver-*rpm' in all repos + # deal with the sliceimage packages + # symlink all instances of plain 'sliceimage-*rpm' in all repos # and cleanup old links - vsrpms=$(find $repositories -name 'vserver*rpm' -a -type f) - vslinks=$(find $repositories -name 'vserver*rpm' -a -type l) + sirpms=$(find $repositories -name 'sliceimage*rpm' -a -type f) + # for nicer upgrades, also remove symlinks from 5.0 + silinks=$(find $repositories '(' -name 'sliceimage*rpm' -o -name 'vserver*rpm' ')' -a -type l) - for vslink in $vslinks; do - [ ! -e $vslink ] && { echo removing old $vslink; rm $vslink; } + for silink in $silinks; do + [ ! -e $silink ] && { echo removing old $silink; rm $silink; } done for repo in $repositories; do - for vsrpm in $vsrpms; do + for sirpm in $sirpms; do # if in the repo we're dealing with, ignore - if [ "$(echo $vsrpm | sed -e s,^$repo,,)" != $vsrpm ] ; then + if [ "$(echo $sirpm | sed -e s,^$repo,,)" != $sirpm ] ; then continue fi - b=$(basename $vsrpm) + b=$(basename $sirpm) link=$repo/$b if [ ! -e $link ] ; then - echo "creating symlink $link towards $vsrpm" - ln -s $vsrpm $link + echo "creating symlink $link towards $sirpm" + ln -s $sirpm $link fi done done @@ -156,6 +187,7 @@ case "$1" in fi # Or than createrepo database [ $package -nt $repository/repodata/repomd.xml ] && need_createrepo=true + [ $package -nt $repository/repodata/filelists.xml.gz ] && need_createrepo=true done if [ -n "$new_rpms" ] ; then @@ -203,15 +235,16 @@ case "$1" in for repository in $repositories ; do rm -rf $repository/signed-stamps rm -rf $repository/repodata - rm -rf $repository/headers find $repository -type l | xargs rm done ;; # (use this only if you have noderepos installed) superclean) + shift find /var/www/html/install-rpms -name signed-stamps | xargs rm -rf + find /var/www/html/install-rpms -name repodata | xargs rm -rf + find /var/www/html/install-rpms -type l | xargs rm rpm -aq | grep noderepo | xargs yum -y reinstall - shift ;; *) echo "Usage: $0 start|force|clean [repo ..]"