Skip to content

Instantly share code, notes, and snippets.

@Wol
Created March 14, 2016 11:20
Show Gist options
  • Save Wol/caac909f29f4162627d1 to your computer and use it in GitHub Desktop.
Save Wol/caac909f29f4162627d1 to your computer and use it in GitHub Desktop.
Drupal release check script
#!/bin/bash
echo "Checking modules"
cat modulelist.txt | while read m
do
# echo -ne "${m}\t"
FILENAME="/tmp/drupaltmp_${m}.xml"
if [ -f $FILENAME ]
then
if [ ! -s $FILENAME ]
then
rm $FILENAME
fi
fi
if [ ! -f $FILENAME ]
then
wget -q -O- https://updates.drupal.org/release-history/${m}/8.x > $FILENAME
fi
RELCOUNT=`xmllint --xpath "count(/project/releases/release)" $FILENAME`
ERRCOUNT=`xmllint --xpath "count(/error)" $FILENAME`
if [ $ERRCOUNT -gt 0 ]; then
# If error text needs to be used, uncomment the following line:
# ERRORTEXT=`xmllint --xpath "/error/text()" $FILENAME`
echo "-"
elif [ $RELCOUNT -eq 0 ]; then
echo "No releases available"
else
RELEASENAME=`xmllint --xpath "/project/releases/release[1]/version/text()" $FILENAME`
echo "$RELEASENAME"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment