Skip to content

Instantly share code, notes, and snippets.

@vermauv
Last active December 26, 2017 08:57
Show Gist options
  • Save vermauv/3478568e4d9ecfdb6e3b164a0ad9f63d to your computer and use it in GitHub Desktop.
Save vermauv/3478568e4d9ecfdb6e3b164a0ad9f63d to your computer and use it in GitHub Desktop.
This script can be used when your drupal project has a list of hacked contrib modules and you haven't yet created the patches.
#!/bin/bash
echo "Please provide the directory having the original modules"
read modulesdir
cd $modulesdir
echo "Please provide the module directory that has the hacked modules eg. /User/username/sites/test/all/modules"
read repo_module_dir
echo "Please provide the path where the patches should be placed"
read patchpath
pwdir=$(pwd);
for files in $(ls); do
echo $files;
cd $pwdir/$files;
git init
git add .
git commit -m "initial commit"
rm -rf *
echo $repo_module_dir/$files
$(cp -rf $repo_module_dir/$files/ ./)
git diff > $files.patch
ls | grep "$files.patch"
mv $files.patch $patchpath/
$(cd ..)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment