Created
August 20, 2015 15:33
-
-
Save colinodell/534aa19805940ea13088 to your computer and use it in GitHub Desktop.
Create Drupal upgrade patches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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