Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Drupal upgrade patches
#!/bin/bash
# A sample script for batch-creating multiple patches at once
# Generate 6.x patches
for i in `seq 0 36`
do
./create-patch.sh 6.$i 6.37
done
# Generate 7.x patches
for i in `seq 0 38`
do
./create-patch.sh 7.$i 7.39
done
#!/bin/bash
# This script takes two arguments - the current version (cv) and the target version (tv)
# Example usage: ./create-patch.sh 7.35 7.39
# Grab the versions
cv=$1
tv=$2
# Do our work in the temp directory
cd /tmp
echo "Downloading files..."
wget http://ftp.drupal.org/files/projects/drupal-$cv.tar.gz &> /dev/null
wget http://ftp.drupal.org/files/projects/drupal-$tv.tar.gz &> /dev/null
echo "Extracting files..."
tar -xf drupal-$cv.tar.gz
tar -xf drupal-$tv.tar.gz
cd drupal-$cv
# Remove a bunch of files we don't care about upgrading
rm .gitignore
rm .htaccess
rm robots.txt
rm sites/default/default.settings.php
cd ../drupal-$tv
rm .gitignore
rm .htaccess
rm robots.txt
rm sites/default/default.settings.php
cd ..
echo "Creating patch file..."
diff -Naur drupal-$cv drupal-$tv > drupal-$cv-$tv.patch
rm -rf drupal-$cv drupal-$cv.tar.gz* drupal-$tv drupal-$tv.tar.gz*
echo "Patch created at /tmp/drupal-$cv-$tv.patch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.