47 lines
1.2 KiB
Text
47 lines
1.2 KiB
Text
|
#!/bin/bash
|
||
|
|
||
|
CORE=${CORE-6.x}
|
||
|
DEVGROUP=${DEVGROUP-drupaladm}
|
||
|
DIRMODE=${DIRMODE-2775}
|
||
|
|
||
|
base=${1-/home/drupal}
|
||
|
|
||
|
if [ $UID -ne 0 ] ; then
|
||
|
echo "This script must be run as root"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Exit on any error
|
||
|
set -e
|
||
|
|
||
|
# Create directories
|
||
|
mkdir --mode=$DIRMODE -v $base
|
||
|
chgrp -v $DEVGROUP $base
|
||
|
|
||
|
for dir in core contrib libraries sites ; do
|
||
|
if [ -d "$base/$dir" ] ; then
|
||
|
echo "Directory $dir already exists ... skipping"
|
||
|
continue
|
||
|
fi
|
||
|
mkdir --mode=$DIRMODE -v $base/$dir
|
||
|
chgrp -v $DEVGROUP $base/$dir
|
||
|
done
|
||
|
|
||
|
# Get drush
|
||
|
egdrupalsymlinks -c $CORE -b $base -d drush
|
||
|
# This is a bit of a hack way to get the drush path
|
||
|
drush=`find $base/drush -type f -name 'drush' | sort | tail -n 1`
|
||
|
|
||
|
# Get core
|
||
|
version=`xmlstarlet sel --net --text --template --match "/project/releases/release[position()=1]/version" --value-of . --nl http://updates.drupal.org/release-history/drupal/$CORE`
|
||
|
echo "Downloading drupal-$version"
|
||
|
pushd $base/core
|
||
|
$drush dl drupal-$version
|
||
|
|
||
|
# Add core version to platform map
|
||
|
echo "drupal-$version $base/core/drupal-$version" >> /etc/egscripts/drupal-platform.map
|
||
|
|
||
|
# Set permissions on sites directory
|
||
|
chgrp -v $DEVGROUP $base/core/drupal-$version/sites
|
||
|
chmod -v g+ws $base/core/drupal-$version/sites
|