]> gitweb.fluxo.info Git - puppet-drupal.git/commitdiff
Latest: operate only on stable releases, filtering out dev, alpha, beta and rc releases
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 7 Feb 2018 19:06:52 +0000 (17:06 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 7 Feb 2018 19:06:52 +0000 (17:06 -0200)
files/drupal

index 94cffe982f44814c5b07d116fed4ec2e981a4fa9..50b0fccc55ea11f944fc84414a61d5752c1e3bb9 100755 (executable)
@@ -163,6 +163,7 @@ function drupal_current {
 }
 
 # Get the latest version of a given series
+# Operate only on stable releases, filtering out dev, alpha, beta and rc releases
 # https://drupal.stackexchange.com/questions/23700/how-to-find-download-latest-drupal-version-via-bash#23704
 function drupal_latest {
   local series="$1"
@@ -171,7 +172,7 @@ function drupal_latest {
     series="8"
   fi
 
-  latest="`wget -O- -q https://updates.drupal.org/release-history/drupal/${series}.x | grep -oPm1 "(?<=<download_link>)[^<]+" | head -1`"
+  latest="`wget -O- -q https://updates.drupal.org/release-history/drupal/${series}.x | grep -oPm1 "(?<=<download_link>)[^<]+" | grep -v -- '-dev' | grep -v -- '-alpha' | grep -v -- '-beta' | grep -v -- '-rc' | head -1`"
   latest="`basename $latest`"
 
   echo $latest | sed -e 's/^drupal-//' -e 's/.tar.gz$//'