#!/bin/bash # # Remove all of the core files from the current directory and replace them the # files from the specified version. Files in the /site directory are left alone # as well as files in the /files directory for sites that use the old file # standard. #echo The variable is $1 #echo The current directory is $CURRENT_DIRECTORY CURRENT_DIRECTORY=`pwd` SOURCE_DIRECTORY=~/DrupalSource echo "Drupal Upgrade Script" if [ -z $1 ] ; then echo Please provide a version exit fi echo "" echo "**" echo "*" echo "* Removing old files" echo "*" echo "**" rm -v `find . -type f | grep -v '/.svn' | grep -v './sites' | grep -v './files' | grep -v '.kpf'` if [ ! -d $SOURCE_DIRECTORY/drupal-$1 ] ; then echo "" echo "**" echo "*" echo "* Don't have Drupal source for version $1" echo "* Fetching Drupal source" echo "*" echo "**" cd $SOURCE_DIRECTORY wget http://ftp.drupal.org/files/projects/drupal-$1.tar.gz echo "**" echo "*" echo "* Expanding tarball" echo "*" echo "**" tar xvzf drupal-$1.tar.gz cd $CURRENT_DIRECTORY fi echo "" echo "**" echo "*" echo "* Copying files" echo "*" echo "**" cp -vR $SOURCE_DIRECTORY/drupal-$1/* . cp -v $SOURCE_DIRECTORY/drupal-$1/.htaccess . echo "" echo "**" echo "*" echo "* Removing unrequired .txt files" echo "*" echo "**" rm -v CHANGELOG.txt COPYRIGHT.txt INSTALL.mysql.txt INSTALL.pgsql.txt INSTALL.txt LICENSE.txt MAINTAINERS.txt UPGRADE.txt INSTALL.sqlite.txt README.txt echo "" echo "**" echo "* Done" echo "**"