[PC-BSD Commits] r3199 - pbibuild/modules/firefox3/overlay-dir

svn at pcbsd.org svn at pcbsd.org
Thu Jan 8 07:13:35 PST 2009


Author: kris
Date: 2009-01-08 07:13:35 -0800 (Thu, 08 Jan 2009)
New Revision: 3199

Modified:
   pbibuild/modules/firefox3/overlay-dir/PBI.SetupScript.sh
Log:

Update firefox3 install script to resist possible bad symlinks causing problems with setting the default browser



Modified: pbibuild/modules/firefox3/overlay-dir/PBI.SetupScript.sh
===================================================================
--- pbibuild/modules/firefox3/overlay-dir/PBI.SetupScript.sh	2009-01-08 14:23:33 UTC (rev 3198)
+++ pbibuild/modules/firefox3/overlay-dir/PBI.SetupScript.sh	2009-01-08 15:13:35 UTC (rev 3199)
@@ -44,30 +44,34 @@
   if [ "$?" = "0" ]
   then
       # Strip out the old BrowserApplication line to make way for the new
-      cat ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals | grep -v '^BrowserApplication' > ${HOMEDIR}/.kdeglobals.new
+      TMPKFILE="/tmp/.kdeglobals.$$"
+      TMPKFILE2="/tmp/.kdeglobals2.$$"
+      rm ${TMPKFILE} >/dev/null
+      cat ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals | grep -v '^BrowserApplication' > ${TMPKFILE}
 
-      touch ${HOMEDIR}/.kdeglobals.new2
+      rm ${TMPKFILE2} >/dev/null
+      touch ${TMPKFILE2}
       while read line
       do
 
          if [ "$line" = "[General]" ]
          then
-           echo "$line" >> ${HOMEDIR}/.kdeglobals.new2
+           echo "$line" >> ${TMPKFILE2}
            if [ "${KDEDIR}" = ".kde4" ]
            then
-             echo "BrowserApplication[$e]=!/usr/local/bin/firefox3" >> ${HOMEDIR}/.kdeglobals.new2
+             echo "BrowserApplication[$e]=!/usr/local/bin/firefox3" >> ${TMPKFILE2}
            else
-             echo "BrowserApplication=!/usr/local/bin/firefox3" >> ${HOMEDIR}/.kdeglobals.new2
+             echo "BrowserApplication=!/usr/local/bin/firefox3" >> ${TMPKFILE2}
            fi
     	 else
-       	   echo "$line" >> ${HOMEDIR}/.kdeglobals.new2
+       	   echo "$line" >> ${TMPKFILE2}
   	 fi
-      done < ${HOMEDIR}/.kdeglobals.new
+      done < ${TMPKFILE}
 
       # all finished, now move it back over kdeglobals
-      rm ${HOMEDIR}/.kdeglobals.new
-      chown ${USERNAME}:${USERNAME} ${HOMEDIR}/.kdeglobals.new2
-      mv ${HOMEDIR}/.kdeglobals.new2 ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals
+      rm ${TMPKFILE}
+      chown ${USERNAME}:${USERNAME} ${TMPKFILE2}
+      mv ${TMPKFILE2} ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals
   fi
 
 else
@@ -88,31 +92,36 @@
 
     if [ -e "${i}/${KDEDIR}/share/config/kdeglobals" ]
     then
+
+      TMPKFILE="/tmp/.kdeglobals.$$"
+      TMPKFILE2="/tmp/.kdeglobals2.$$"
+      rm ${TMPKFILE} >/dev/null
       # Strip out the old BrowserApplication line to make way for the new
-      cat ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals | grep -v '^BrowserApplication' > ${HOMEDIR}/.kdeglobals.new
+      cat ${HOMEDIR}/${KDEDIR}/share/config/kdeglobals | grep -v '^BrowserApplication' > ${TMPKFILE}
 
-      touch ${HOMEDIR}/.kdeglobals.new2
+      rm ${TMPKFILE2} >/dev/null
+      touch ${TMPKFILE2}
       while read line
       do
 
          if [ "$line" = "[General]" ]
          then
-           echo "$line" >> ${HOMEDIR}/.kdeglobals.new2
+           echo "$line" >> ${TMPKFILE2}
            if [ "${KDEDIR}" = ".kde4" ]
            then
-             echo "BrowserApplication[$e]=!/usr/local/bin/firefox3" >> ${HOMEDIR}/.kdeglobals.new2
+             echo "BrowserApplication[$e]=!/usr/local/bin/firefox3" >> ${TMPKFILE2}
            else
-             echo "BrowserApplication=!/usr/local/bin/firefox3" >> ${HOMEDIR}/.kdeglobals.new2
+             echo "BrowserApplication=!/usr/local/bin/firefox3" >> ${TMPKFILE2}
            fi
          else
-           echo "$line" >> ${HOMEDIR}/.kdeglobals.new2
+           echo "$line" >> ${TMPKFILE2}
          fi
-      done < ${HOMEDIR}/.kdeglobals.new
+      done < ${TMPKFILE}
 
       # all finished, now move it back over kdeglobals
-      rm ${HOMEDIR}/.kdeglobals.new
-      chown ${i}:${i} ${HOMEDIR}/.kdeglobals.new2
-      mv ${i}/.kdeglobals.new2 ${i}/${KDEDIR}/share/config/kdeglobals
+      rm ${TMPKFILE}
+      chown ${i}:${i} ${TMPKFILE2}
+      mv ${TMPKFILE2} ${i}/${KDEDIR}/share/config/kdeglobals
     fi
   done
 



More information about the Commits mailing list