]> gitweb.fluxo.info Git - puppet-pmwiki.git/commitdiff
Getting the latest release automatically (2)
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 13 Mar 2014 13:44:38 +0000 (10:44 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 13 Mar 2014 13:44:38 +0000 (10:44 -0300)
templates/pmwiki.sh.erb

index f978182942505444c276adf667888d75ac8d78bd..2fef04b742e3fa90b4bc20e7a9538be732862d9c 100644 (file)
@@ -17,15 +17,16 @@ function pmwiki_check_existing {
 # Deploy a fresh pmwiki tree
 function pmwiki_deploy {
   if [ "$#" != "1" ]; then
-    latest="`lynx -dump http://www.pmwiki.org/pub/pmwiki/ 2> /dev/null | grep ".tgz$" | grep -v latest | sed -e 's/^.* http/http/' | head -1`"
+    new="`lynx -dump http://www.pmwiki.org/pub/pmwiki/ 2> /dev/null | grep ".tgz$" | grep -v latest | sed -e 's/^.*-//' | head -1`"
 
-    if [ -z "$latest" ]; then
+    if [ -z "$new" ]; then
       echo "Unable to determine latest release, please specify it manually:"
       echo "Usage: `basename $0` deploy <version>"
+    else
+      new="`basename $new .tgz`"
     fi
   else
     new="$1"
-    latest="http://pmwiki.org/pub/pmwiki/pmwiki-$new.tgz"
   fi
 
   # Setup
@@ -33,7 +34,7 @@ function pmwiki_deploy {
   pmwiki_check_existing $new
 
   # Deploy a fresh pmwiki tree
-  wget $latest
+  wget http://pmwiki.org/pub/pmwiki/pmwiki-$new.tgz
   wget http://pmwiki.org/pub/pmwiki/i18n/i18n-all.zip
   tar zxvf pmwiki-$new.tgz && rm pmwiki-$new.tgz
   ( cd pmwiki-$new && unzip -o ../i18n-all.zip && rm $_ )