fix: yum clean all installroot was pointing at the wrong directory
[bootstrapfs.git] / build.sh
index 0a6c557..00cda86 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -62,11 +62,14 @@ pkgsfile=$(pl_locateDistroFile ../build/ ${pldistro} bootstrapfs.pkgs)
 # -k = exclude kernel* packages
 pl_root_mkfedora -k -f $pkgsfile ${vref} 
 
-postfile=$(pl_locateDistroFile ../build/ ${pldistro} bootstrapfs.post)
-[ "$postfile" != "not-found-by-pl_locateDistroFile" ] && /bin/bash $postfile ${vref} || :
+# optionally invoke a post processing script after packages from
+# $pkgsfile have been installed
+pkgsdir=$(dirname $pkgsfile)
+pkgsname=$(basename $pkgsfile .pkgs)
+postfile="${pkgsdir}/${pkgsname}.post"
+[ -f $postfile ] && /bin/bash $postfile ${vref} || :
 
 # for distros that do not define bootstrapfs variants
-shopt -s nullglob
 pkgs_count=$(ls ../build/config.${pldistro}/bootstrapfs-*.pkgs 2> /dev/null | wc -l)
 [ $pkgs_count -gt 0 ] && for pkgs in $(ls ../build/config.${pldistro}/bootstrapfs-*.pkgs); do
     NAME=$(basename $pkgs .pkgs | sed -e s,bootstrapfs-,,)
@@ -96,8 +99,12 @@ pkgs_count=$(ls ../build/config.${pldistro}/bootstrapfs-*.pkgs 2> /dev/null | wc
         umount ${vdir}/proc
     fi
 
-    postfile=$(echo $pkgs | sed -e s,pkgs,post, )
-       [ "$postfile" != "not-found-by-pl_locateDistroFile" ] && /bin/bash $postfile ${vdir} || :
+    # optionally invoke a post processing script after packages from
+    # $pkgs have been installed
+    pkgsdir=$(dirname $pkgs)
+    pkgsname=$(basename $pkgs .pkgs)
+    postfile="${pkgsdir}/${pkgsname}.post"
+    [ -f $postfile ] && /bin/bash $postfile ${vdir} || :
 
 
     # Create a copy of the ${NAME} bootstrap filesystem w/o the base
@@ -136,7 +143,7 @@ done
 
 # Build the base Bootstrap filesystem
 # clean out yum cache to reduce space requirements
-yum -c ${vref}/etc/yum.conf --installroot=${vdir} -y clean all
+yum -c ${vref}/etc/yum.conf --installroot=${vref} -y clean all
 
 echo "--------STARTING tar'ing PlanetLab-Bootstrap.tar.bz2: $(date)"
 tar -cpjf PlanetLab-Bootstrap.tar.bz2 -C ${vref} .