Create/Apply patch from/to original Geonetwork
The patch file 'geonetwork.patch' included in the tern-geonetwork git repository was created between original geonetwork folder extracted from war file under /var/lib/tomcat7/webapps and the TERN customized geonetwork in Bitbucket repository
Create patch file
1. Clone tern-geonetwork repository to local directory, for example /home/ubuntu
git clone https://bitbucket.org/ternhq/tern-geonetwork.git tern-geonetwork
2. cd to /home/ubuntu and run the following command
diff -Naur /home/ubuntu/geonetwork/ /home/ubuntu/tern-geonetwork/ > geonetwork.patch
Apply patch file to Geonetwork
1. After geonetwork is extracted from war file to /var/lib/tomcat7/webapps, stop tomcat service
service tomcat7 stop
2. cd to the original geonetwork folder and run the following
patch -p4 -t < /PATH/TO/PATCH/FILE
The patch file contains all the file names in absolute path format. So when we execute from the geonetwork folder, without the “-p” option, it will not work properly.
-p4 tells the patch command to skip 4 leading slashes from the file names present in the patch file. In our case, the file name in patch file is “/home/ubuntu/tern-geonetwork/FILENAME”, since we have given “-p4”, 4 leading slashes, i.e. until /home/ubuntu/tern-geonetwork/ is ignored.
Correct Ownership of the geonetwork folder and edit jdbc.properties file
After apply the patch to geonetwork folder under /var/lib/tomcat7/webapps, we need to make sure the folder belongs to tomcat7 user and tomcat7 group.
cp -pr /home/ubuntu/tern-geonetwork/* /var/lib/tomcat7/webapps/geonetwork
cd /var/lib/tomcat7/webapps/geonetwork
chown -R tomcat7.tomcat7 *
Edit /var/lib/tomcat7/webapps/geonetwork/WEB-INF/config-db/jdbc.properties file, change username and password for db connection
restart tomcat
service tomcat7 start