install-osrf.sh: be smarter about adding opensrf bin directory to path
[sitka/sitka-tools.git] / deployment / install-osrf.sh
index f49558d..3c1feb9 100755 (executable)
@@ -53,7 +53,12 @@ su -l -c "cd ${BUILDDIR} && make" ${DEFAULT_USER}
 echo "Installing OpenSRF..."
 cd ${BUILDDIR} && make install
 useradd -m -s /bin/bash opensrf
-echo "export PATH=\$PATH:${INSTALLDIR}/bin" >> /home/opensrf/.bashrc
+PATHFILES="/etc/profile /home/opensrf/.bashrc"
+for PATHFILE in ${PATHFILES} ; do
+  if [[ -e "${PATHFILE}" && ! `egrep "PATH=.*${INSTALLDIR}/bin" "${PATHFILE}"` ]] ; then 
+    echo "export PATH=${INSTALLDIR}/bin:\$PATH" >> ${PATHFILE}
+  fi
+done
 chown -R opensrf:opensrf ${INSTALLDIR}
  
 # as root, add the following two lines to /etc/hosts: