yum-arch is not supported on recent fedoras
[myplc.git] / plc.d / packages
index dab7fca..69564d5 100755 (executable)
@@ -7,7 +7,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: packages,v 1.6 2007/01/30 15:56:53 thierry Exp $
+# $Id$
 #
 
 # Source function library and configuration
@@ -19,6 +19,10 @@ set -x
 
 case "$1" in
     start)
+       if [ "$PLC_BOOT_ENABLED" != "1" ] ; then
+           exit 0
+       fi
+
        MESSAGE=$"Signing and indexing node packages"
        dialog "$MESSAGE"
 
@@ -40,9 +44,9 @@ case "$1" in
            createrepo=0
 
            # Create a stamp once the package gets signed
-           mkdir $repository/signed-stamps
+           mkdir $repository/signed-stamps 2> /dev/null
 
-           for package in $repository/*.rpm ; do
+           for package in $(find $repository/ -name '*.rpm') ; do
                stamp=$repository/signed-stamps/$(basename $package).signed
                # If package is newer than signature stamp
                if [ $package -nt $stamp ] ; then
@@ -75,18 +79,22 @@ case "$1" in
            # .oldheaders and .olddata directories accidentally.
            rm -rf $repository/{.oldheaders,.olddata}
 
+           type -p yum-arch > /dev/null && have_yum_arch="true"
+
            # Old command is yum-arch
-           if [ $yum_arch -eq 1 ] ; then
-               yum-arch $repository
+           if [ -n "$have_yum_arch" -a $yum_arch -eq 1 ] ; then
+               yum-arch $repository 
                check
            fi
 
+           type -p createrepo > /dev/null && have_createrepo="true"
+
            # New command is createrepo
-           if [ $createrepo -eq 1 ] ; then
+           if [ -n "$have_createrepo" -a $createrepo -eq 1 ] ; then
                if [ -f $repository/yumgroups.xml ] ; then
-                   createrepo -g yumgroups.xml $repository
+                   createrepo --quiet -g yumgroups.xml $repository 
                else
-                   createrepo $repository
+                   createrepo --quiet $repository
                fi
                check
            fi