install-eg.sh: do not replace existing conf files if there are no changes
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 18 May 2016 19:38:52 +0000 (12:38 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 18 May 2016 19:38:52 +0000 (12:38 -0700)
deployment/install-eg.sh

index b389b79..48b40bf 100755 (executable)
@@ -78,8 +78,12 @@ chown -R opensrf:opensrf ${INSTALLDIR}
 APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/eg_startup /etc/apache2/envvars"
 for APACHEFILE in ${APACHEFILES}
 do
 APACHEFILES="/etc/apache2/eg_vhost.conf /etc/apache2/eg_startup /etc/apache2/envvars"
 for APACHEFILE in ${APACHEFILES}
 do
-  mv ${APACHEFILE} ${APACHEFILE}.bak
-  cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
+  if `cmp -s ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}` ; then
+    echo "${APACHEFILE} is unchanged, so not updating"
+  else
+    mv ${APACHEFILE} ${APACHEFILE}.bak
+    cp ${SITKACONF}/files/${APACHEFILE}/${HOSTNAME} ${APACHEFILE}
+  fi
 done
 #if [ ! -d "/etc/apache2/ssl" ]
 #then
 done
 #if [ ! -d "/etc/apache2/ssl" ]
 #then
@@ -121,8 +125,12 @@ fi
 OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
 for OSRFCONFFILE in ${OSRFCONFFILES}
 do
 OSRFCONFFILES="${INSTALLDIR}/conf/opensrf.xml ${INSTALLDIR}/conf/opensrf_core.xml"
 for OSRFCONFFILE in ${OSRFCONFFILES}
 do
-  mv ${OSRFCONFFILE} ${OSRFCONFFILE}.bak
-  cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
+  if `cmp -s ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}` ; then
+    echo "${OSRFCONFFILE} is unchanged, so not updating"
+  else
+    mv ${OSRFCONFFILE} ${OSRFCONFFILE}.bak
+    cp ${SITKACONF}/files/${OSRFCONFFILE}/${HOSTNAME} ${OSRFCONFFILE}
+  fi
 done
 if [ ! -f "/home/opensrf/.srfsh.xml" ]
 then
 done
 if [ ! -f "/home/opensrf/.srfsh.xml" ]
 then