Deprecated: Assigning the return value of new by reference is deprecated in /home/bluestat/public_html/source/index.php on line 477
From c618a7010c5a08d3c1e18f3995dfab3f15195725 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Tue, 7 Apr 2009 13:50:16 -0400 Subject: [PATCH] Update all the paths to use ROOT instead of relative ones --- bin/flashsync.py | 6 +++--- lib/FlashSync/DeviceManager.py | 4 ++-- lib/FlashSync/Monitor.py | 8 ++++---- lib/FlashSync/UpdatePuller.py | 12 ++++++------ lib/FlashSync/Updater.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/flashsync.py b/bin/flashsync.py index c7b423e..46d4aee 100755 --- a/bin/flashsync.py +++ b/bin/flashsync.py @@ -40,11 +40,11 @@ if (len(sys.argv) < 2): command = sys.argv[1] if (command == "shutdown"): - if (not os.path.exists("db/pid")): + if (not os.path.exists(ROOT + "/db/pid")): print("FlashSync daemon is not running.") sys.exit() - f = open("db/pid", 'r') + f = open(ROOT + "/db/pid", 'r') pid = int(f.read()) f.close() @@ -53,7 +53,7 @@ if (command == "shutdown"): except os.error: print("FlashSync daemon is not running.") - os.unlink("db/pid") + os.unlink(ROOT + "/db/pid") elif (command == "sync"): Monitor.sync() diff --git a/lib/FlashSync/DeviceManager.py b/lib/FlashSync/DeviceManager.py index 4ef899e..000d4ef 100644 --- a/lib/FlashSync/DeviceManager.py +++ b/lib/FlashSync/DeviceManager.py @@ -84,7 +84,7 @@ def eject(volume): def getNodes(): """Returns the db/nodes file as a list""" - f = open("db/nodes") + f = open(FlashSync.ROOT + "/db/nodes") nodes = f.readlines() f.close() return map(lambda x: x.strip(), nodes) @@ -93,7 +93,7 @@ def getNodes(): def _writeNodes(nodes): """Writes out the db/nodes file""" - fd = open("db/nodes", 'w') + fd = open(FlashSync.ROOT + "/db/nodes", 'w') for n in nodes: if (n.strip() != ""): fd.write(n + "\n") diff --git a/lib/FlashSync/Monitor.py b/lib/FlashSync/Monitor.py index a09267f..af2546c 100644 --- a/lib/FlashSync/Monitor.py +++ b/lib/FlashSync/Monitor.py @@ -23,8 +23,8 @@ from threading import Timer def daemonize(): """Forks out the process as a daemon""" - if os.path.exists("db/pid"): - f = open("db/pid", "a+") + if os.path.exists(FlashSync.ROOT + "/db/pid"): + f = open(FlashSync.ROOT + "/db/pid", "a+") f.seek(0) pid = int(f.read()) f.close() @@ -32,7 +32,7 @@ def daemonize(): os.kill(pid, 0) except os.error: logging.warning("Stale db/pid file. Removing.") - os.unlink("db/pid") + os.unlink(FlashSync.ROOT + "/db/pid") _updateLock(False) else: raise SystemExit, "FlashSync daemon is already running." @@ -49,7 +49,7 @@ def daemonize(): os.dup2(0, 1) os.dup2(0, 2) - f = open("db/pid", 'w+') + f = open(FlashSync.ROOT + "/db/pid", 'w+') f.write(str(os.getpid())) f.close() else: diff --git a/lib/FlashSync/UpdatePuller.py b/lib/FlashSync/UpdatePuller.py index 44fa1a9..b1209e4 100644 --- a/lib/FlashSync/UpdatePuller.py +++ b/lib/FlashSync/UpdatePuller.py @@ -17,14 +17,14 @@ see . import urllib, os, logging def updateComboFix(): - target = "db/manifest/SPYWARE/ComboFix.exe" + target = FlashSync.ROOT + "/db/manifest/SPYWARE/ComboFix.exe" if (os.path.exists(target)): os.unlink(target) urllib.urlretrieve("http://download.bleepingcomputer.com/sUBs/ComboFix.exe", target) logging.info("Updated ComboFix") def updateMcAfeeDefs(): - target = "db/manifest/ANTIVIRUS/MCAFEE/dats-latest.zip" + target = FlashSync.ROOT + "/db/manifest/ANTIVIRUS/MCAFEE/dats-latest.zip" if (os.path.exists(target)): os.unlink(target) url = _getMcAfeeURL() @@ -37,7 +37,7 @@ def updateMcAfeeDefs(): def _getMcAfeeURL(): urlt = "http://download.nai.com/products/datfiles/4.x/nai/dat-%d.zip" - f = open("db/naiv", 'a+') + f = open(FlashSync.ROOT + "/db/naiv", 'a+') f.seek(0) datv = int(f.read()) @@ -59,21 +59,21 @@ def _getMcAfeeURL(): return None def updateAIMFix(): - target = "db/manifest/SPYWARE/AIMFix.exe" + target = FlashSync.ROOT + "/db/manifest/SPYWARE/AIMFix.exe" if (os.path.exists(target)): os.unlink(target) urllib.urlretrieve("http://www.jayloden.com/AIMFix.exe", target) logging.info("Updated AIMFix") def updateMalwareBytes(): - target = "db/manifest/SPYWARE/mbam-setup.exe" + target = FlashSync.ROOT + "/db/manifest/SPYWARE/mbam-setup.exe" if (os.path.exists(target)): os.unlink(target) urllib.urlretrieve("http://www.gt500.org/malwarebytes/mbam-setup.exe", target) logging.info("Updated MalwareBytes installer") def updateMalwareBytesDats(): - target = "db/manifest/SPYWARE/mbam-rules.exe" + target = FlashSync.ROOT + "/db/manifest/SPYWARE/mbam-rules.exe" if (os.path.exists(target)): os.unlink(target) urllib.urlretrieve("http://www.gt500.org/malwarebytes/mbam-rules.exe", target) diff --git a/lib/FlashSync/Updater.py b/lib/FlashSync/Updater.py index 96f0c69..2962682 100644 --- a/lib/FlashSync/Updater.py +++ b/lib/FlashSync/Updater.py @@ -21,7 +21,7 @@ from FlashSync import UpdatePuller def updateOnSchedule(): """Runs update() if it hasn't done so in 24 hours""" - fd = open("db/updater", 'a+') + fd = open(FlashSync.ROOT + "/db/updater", 'a+') fd.seek(0) timestamp = fd.read() if (timestamp == ""): -- 1.7.11.3