X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc.d%2Fpackages;h=f31e578d53f34cedee714ba21937fff7cee08aa1;hb=deb99ee9b54ecc2ef0c339759a4aaf53e9ff0080;hp=60f3c842da8192415f7b6e4a320a7372a6d63aa2;hpb=cba769253ac770b3b63343e6ee3e545b95ae9bcf;p=nodeimage.git diff --git a/plc.d/packages b/plc.d/packages index 60f3c84..f31e578 100755 --- a/plc.d/packages +++ b/plc.d/packages @@ -16,7 +16,36 @@ # 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 +# +#################### + + +# 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 @@ -94,7 +123,7 @@ case "$1" in vslinks=$(find $repositories -name 'vserver*rpm' -a -type l) for vslink in $vslinks; do - [ ! -e $vslink ] && echo removing old $vslink + [ ! -e $vslink ] && { echo removing old $vslink; rm $vslink; } done for repo in $repositories; do @@ -107,6 +136,7 @@ case "$1" in link=$repo/$b if [ ! -e $link ] ; then echo "creating symlink $link towards $vsrpm" + ln -s $vsrpm $link fi done done @@ -146,6 +176,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 @@ -160,7 +191,9 @@ case "$1" in --define "_gpg_path /etc/planetlab" \ --define "_gpg_name $PLC_MAIL_SUPPORT_ADDRESS" \ --resign $new_rpms && touch $new_stamps - check +# check + # if we sign at least one package then we need to reindex + need_createrepo=true fi # Update repository index / yum metadata. @@ -168,10 +201,11 @@ case "$1" in if [ -n "$need_createrepo" ] ; then if [ -f $repository/yumgroups.xml ] ; then createrepo --quiet -g yumgroups.xml $repository + check else createrepo --quiet $repository + check fi - check fi done @@ -190,10 +224,17 @@ 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 + ;; *) echo "Usage: $0 start|force|clean [repo ..]" ;;