[or-cvs] r11548: Fix a potential issue in the osx pre and postflight scripts. (tor/trunk/contrib/osx)

phobos at seul.org phobos at seul.org
Fri Sep 21 01:59:53 UTC 2007


Author: phobos
Date: 2007-09-20 21:59:53 -0400 (Thu, 20 Sep 2007)
New Revision: 11548

Modified:
   tor/trunk/contrib/osx/TorPostflight
   tor/trunk/contrib/osx/TorPreFlight
Log:
Fix a potential issue in the osx pre and postflight scripts.


Modified: tor/trunk/contrib/osx/TorPostflight
===================================================================
--- tor/trunk/contrib/osx/TorPostflight	2007-09-21 00:29:10 UTC (rev 11547)
+++ tor/trunk/contrib/osx/TorPostflight	2007-09-21 01:59:53 UTC (rev 11548)
@@ -83,10 +83,10 @@
 fi
 
 # If the pre-install script did it's thing, it should have saved the
-# config and server keys; put these back and clean up
-if [ -f /tmp/TorSavedMe.tar.gz ]; then
-   tar zxf /tmp/TorSavedMe.tar.gz -C /
-   rm /tmp/TorSavedMe.tar.gz
+# config and server keys; put these back and leave for save keeping
+TORBACKUP=`ls -rt /tmp/TorSavedMe*| tail -1`
+if [ -f ${TORBACKUP} ]; then
+   tar zxf ${TORBACKUP} -C /
 fi
 
 if [ -d /Library/StartupItems/Tor ]; then

Modified: tor/trunk/contrib/osx/TorPreFlight
===================================================================
--- tor/trunk/contrib/osx/TorPreFlight	2007-09-21 00:29:10 UTC (rev 11547)
+++ tor/trunk/contrib/osx/TorPreFlight	2007-09-21 01:59:53 UTC (rev 11548)
@@ -1,5 +1,6 @@
 #!/bin/sh
 # TorPreFlight is invoked before the install begins
+TMPFILE=`mktemp /tmp/TorSavedMe.tgz.XXXXXXXXXXXXX` 
 
 # Figure out where Tor is installed
 if [ -f /Library/StartupItems/Tor/Tor.loc ]; then
@@ -16,12 +17,12 @@
 
 # Backup all of Tor, just in case
 if [ -d $TORPATH ]; then
-	tar zcf /tmp/TorSavedMe.tar.gz $TORPATH/var/lib/tor $TORPATH/torrc $PRIVOXYPATH/config $PRIVOXYPATH/user.action
+	tar zcf ${TMPFILE} ${TORPATH}/var/lib/tor ${TORPATH}/torrc ${PRIVOXYPATH}/config ${PRIVOXYPATH}/user.action
 fi
 
 # Remove Tor and everything to do with it
-if [ -f $TORPATH/uninstall_tor_bundle.sh ]; then
-	$TORPATH/uninstall_tor_bundle.sh
+if [ -f ${TORPATH}/uninstall_tor_bundle.sh ]; then
+	${TORPATH}/uninstall_tor_bundle.sh
 else
 	$PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh
 fi



More information about the tor-commits mailing list