BASE=${BASE:="/var/www/data"}
SITES=${SITES:="$BASE/drupal"}
-SERIES="6 7 8"
+SERIES="6 7 8 9"
+LATEST_SERIES="9"
# Ensure we have a proper path, useful when called through cron
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
local series="$1"
if [ -z "$series" ]; then
- series="8"
+ series="$LATEST_SERIES"
fi
if [ -e "$BASE/drupal-${series}" ]; then
local series="$1"
if [ -z "$series" ]; then
- series="8"
+ series="$LATEST_SERIES"
fi
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`"
fi
# Check for latest releases if no specific version was given
- if [ "$new" == "8" ]; then
+ if [ "$new" == "9" ]; then
+ drupal_series="9"
+ new="`drupal_latest 9`"
+ elif [ "$new" == "8" ]; then
drupal_series="8"
new="`drupal_latest 8`"
elif [ "$new" == "7" ]; then
new="$2"
# Fix versions if just a series is given
- if [ "$old" == "8" ] && [ -z "$new" ]; then
+ if [ "$old" == "9" ] && [ -z "$new" ]; then
+ old="`drupal_current 9`"
+ new="`drupal_latest 9`"
+ drupal_series="9"
+ elif [ "$old" == "8" ] && [ -z "$new" ]; then
old="`drupal_current 8`"
new="`drupal_latest 8`"
drupal_series="8"
class drupal::autoupgrade {
+ # Keep 9.x codebase updated
+ cron { "drupal-autoupgrade-9.x":
+ command => "/usr/local/bin/drupal upgrade 9",
+ user => root,
+ # Run once a week after security releases (usually on Wednesdays)
+ weekday => 5,
+ hour => "01",
+ minute => "30",
+ environment => [ 'SILENT=yes' ],
+ ensure => present,
+ require => [ File['/usr/local/bin/drupal'], User['drupal'] ],
+ }
+
# Keep 8.x codebase updated
cron { "drupal-autoupgrade-8.x":
command => "/usr/local/bin/drupal upgrade 8",
backup => false,
}
+ # Ensure we have an 9.x instance
+ exec { 'drupal-download-9.x':
+ command => '/usr/local/bin/drupal download 9',
+ user => "root",
+ creates => '/var/www/data/drupal-9',
+ require => File['/usr/local/bin/drupal'],
+ }
+
# Ensure we have an 8.x instance
exec { 'drupal-download-8.x':
command => '/usr/local/bin/drupal download 8',