install-eg.sh: handle permission assignment better on prod
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Sun, 22 May 2016 05:13:52 +0000 (22:13 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Sun, 22 May 2016 05:17:08 +0000 (22:17 -0700)
deployment/install-eg.sh

index a70f6d6..b23f81c 100755 (executable)
@@ -261,7 +261,16 @@ cd ${INSTALLDIR}/var/web/opac/extras && git clone git://git.sitka.bclibraries.ca
 
 # 9. make sure opensrf owns all the stuff we just did
 echo 'managing file permissions...'
-chown -R opensrf:opensrf ${INSTALLDIR} 2>/dev/null
+if [[ ! -n "$PROD" ]] ; then
+  chown -R opensrf:opensrf ${INSTALLDIR} 2>/dev/null
+else
+  for file in `ls -1 ${INSTALLDIR} | grep -v var` ; do chown -R opensrf:opensrf ${INSTALLDIR}/$file ; done
+  chown opensrf:opensrf ${INSTALLDIR}/var
+  for file in `ls -1 ${INSTALLDIR}/var | egrep -v '(data|tmp|web)'` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/$file ; done
+  chown opensrf:opensrf ${INSTALLDIR}/var/data ${INSTALLDIR}/var/web
+  for file in `ls -1 ${INSTALLDIR}/var/data | grep -v offline` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/data/$file ; done
+  for file in `ls -1 ${INSTALLDIR}/var/web | grep -v reporter` ; do chown -R opensrf:opensrf ${INSTALLDIR}/var/web/$file ; done
+fi
 chown -R opensrf:opensrf /home/opensrf
 SKINDIRS="${INSTALLDIR}/var/skins ${INSTALLDIR}/var/web/css/skin"
 for SKINDIR in ${SKINDIRS} ; do