[or-cvs] r12748: Make new USB Tor for modified Vidalia Give up on patching pr (torpedo/trunk/build-scripts)

sjm217 at seul.org sjm217 at seul.org
Sun Dec 9 20:06:09 UTC 2007


Author: sjm217
Date: 2007-12-09 15:06:09 -0500 (Sun, 09 Dec 2007)
New Revision: 12748

Added:
   torpedo/trunk/build-scripts/FirefoxPortable.ini
   torpedo/trunk/build-scripts/prefs.js
   torpedo/trunk/build-scripts/vidalia.conf
Modified:
   torpedo/trunk/build-scripts/buildpackage.py
Log:
Make new USB Tor for modified Vidalia
Give up on patching prefs.js (Firefox doesn't take my changes)

Added: torpedo/trunk/build-scripts/FirefoxPortable.ini
===================================================================
--- torpedo/trunk/build-scripts/FirefoxPortable.ini	                        (rev 0)
+++ torpedo/trunk/build-scripts/FirefoxPortable.ini	2007-12-09 20:06:09 UTC (rev 12748)
@@ -0,0 +1,18 @@
+[FirefoxPortable]
+FirefoxDirectory=App\firefox
+ProfileDirectory=Data\profile
+SettingsDirectory=Data\settings
+PluginsDirectory=Data\plugins
+FirefoxExecutable=firefox.exe
+AdditionalParameters=
+LocalHomepage=
+DisableSplashScreen=false
+AllowMultipleInstances=false
+DisableIntelligentStart=false
+SkipChromeFix=false
+SkipCompregFix=false
+RunLocally=false
+WaitForFirefox=true
+
+# The above options are explained in the included readme.txt
+# This INI file is an example only and is not used unless it is placed as described in the included readme.txt
\ No newline at end of file

Modified: torpedo/trunk/build-scripts/buildpackage.py
===================================================================
--- torpedo/trunk/build-scripts/buildpackage.py	2007-12-09 19:11:22 UTC (rev 12747)
+++ torpedo/trunk/build-scripts/buildpackage.py	2007-12-09 20:06:09 UTC (rev 12748)
@@ -1,9 +1,9 @@
 #!/usr/bin/python
 
 ##
-## Produce a Tor+Vidalia+Firefox bundle from PortableTor and FirefoxPortable
+## Produce a Tor+Vidalia+Firefox bundle from PortableTor, FirefoxPortable and Vidalia
 ## Steven J. Mudoch <http://www.cl.cam.ac.uk/users/sjm217/>
-## $Id:$
+## $Id$
 ##
 
 import os
@@ -11,73 +11,13 @@
 import subprocess
 import re
 
-## Additional preferences
-preferences = {
-        ## Connect direct to Tor
-        "network.proxy.socks": "127.0.0.1",
-        "network.proxy.socks_port": 9050,
-        "network.proxy.socks_remote_dns": True,
-        "network.proxy.type": 1,
-        
-        ## Disable disk cache
-        "browser.cache.disk.capacity": 0,
-        "browser.cache.disk.enable": False,
-        
-        ## Homepage
-        "browser.startup.homepage": "http://check.torproject.org/",
-
-        ## Don't check as default
-        "browser.shell.checkDefaultBrowser": False,
-
-        ## Start up with actual browser start page
-        "browser.startup.homepage_override.mstone": "rv:1.8.1.10"
-}
-
-def to_js(val):
-        '''Convert a Python object to Javascript'''
-        if type(val)==str:
-                return '"%s"'%val
-        elif type(val)==bool:
-                if val:
-                        return "true"
-                else:
-                        return "false"
-        else:
-                return str(val)
-
-user_pref_re = re.compile(r'\s*user_pref\("([^"]+)"\s*,\s*("[^"]+"|[^)\s]+)\s*\)\s*;')
-def patch_preferences(origfile, newfile):
-        '''Patch a preferences file'''
-        if origfile == None:
-                origfile = []
-                
-        output = []
-
-        for line in origfile:
-                match = user_pref_re.match(line)
-                if not match:
-                        output.append(line)
-                else:
-                        key = match.group(1)
-                        val = match.group(2)
-                        val = preferences.get(key, val)
-                        if preferences.has_key(key):
-                                del preferences[key]
-                        output.append("user_pref(%s, %s);\n"%(to_js(key), to_js(val)))
-        for k, v in preferences.items():
-                output.append("user_pref(%s, %s);\n"%(to_js(k), to_js(v)))
-        
-        ## prefs.js must be sorted (and other requirements?)
-        output.sort()
-        for o in output:
-                newfile.write(o)
-
 ## Output directory (will be overwritten)
 dest = "Tor Browser"
 
-## Extracted directories containing FirefoxPortable and PortableTor
+## Extracted directories containing FirefoxPortable, PortableTor and Vidalia
 fp_src = "FirefoxPortable"
 tp_src = "PortableTor/PortableTor"
+vi_src = "release"
 
 ## 7zip executable
 sevenzip = os.path.join("C:\\", "Program Files", "7-Zip", "7z.exe")
@@ -95,27 +35,31 @@
 shutil.copytree(tp_src, os.path.join(dest, "PortableTor"))
 
 ## Set config options
-#prefs_fn = os.path.join(dest, "FirefoxPortable", "App", "DefaultData", "profile", "prefs.js")
-prefs_fn = os.path.join(dest, "FirefoxPortable", "App", "DefaultData", "profile", "user.js")
-#oldprefs_fn = prefs_fn+".orig"
-#shutil.copyfile(prefs_fn, oldprefs_fn)
+prefs_fn = os.path.join(dest, "FirefoxPortable", "App", "DefaultData", "profile", "prefs.js")
+oldprefs_fn = prefs_fn+".orig"
+os.rename(prefs_fn, oldprefs_fn)
 
-infile = file(oldprefs_fn, "rt")
-outfile = file(prefs_fn, "wt")
-patch_preferences(infile, outfile)
-infile.close()
-outfile.close()
+shutil.copyfile("prefs.js", prefs_fn)
 
 ## Remove Privoxy
 os.unlink(os.path.join(dest, "PortableTor","App","privoxy.exe"))
 shutil.rmtree(os.path.join(dest, "PortableTor","Docs","Privoxy"))
 shutil.rmtree(os.path.join(dest, "PortableTor","Data","Privoxy"))
 
+## Replace vidalia.conf
+shutil.copyfile("vidalia.conf", os.path.join(dest, "PortableTor", "Data", "Vidalia", "vidalia.conf"))
+
+## Apply .ini file
+shutil.copyfile("FirefoxPortable.ini", os.path.join(dest, "FirefoxPortable", "FirefoxPortable.ini"))
+
+## Replace Vidalia
+for fn in os.listdir(vi_src):
+        shutil.copyfile(os.path.join(vi_src, fn), os.path.join(dest, "PortableTor", "App", fn))
+                
 ## Write launcher
 fh = file(os.path.join(dest, "Tor Browser.bat"), "wt")
-fh.write(r'start /b .\PortableTor\App\vidalia.exe --datadir ".\PortableTor\Data\Vidalia\"'+"\n")
-fh.write(r'start /b .\FirefoxPortable\FirefoxPortable.exe'+"\n")
+fh.write('start /b .\\PortableTor\\App\\vidalia.exe --datadir .\\PortableTor\\Data\\Vidalia\\'+'\n')
 fh.close()
 
 ## Compress it all
-subprocess.call([sevenzip, "a", "-sfx7z.sfx", "Tor Browser.exe", dest], shell=False)             
+#subprocess.call([sevenzip, "a", "-sfx7z.sfx", "Tor Browser.exe", dest], shell=False)             

Added: torpedo/trunk/build-scripts/prefs.js
===================================================================
--- torpedo/trunk/build-scripts/prefs.js	                        (rev 0)
+++ torpedo/trunk/build-scripts/prefs.js	2007-12-09 20:06:09 UTC (rev 12748)
@@ -0,0 +1,35 @@
+# Mozilla User Preferences
+
+/* Do not edit this file.
+ *
+ * If you make changes to this file while the application is running,
+ * the changes will be overwritten when the application exits.
+ *
+ * To make a manual change to preferences, you can visit the URL about:config
+ * For more information, see http://www.mozilla.org/unix/customizing.html#prefs
+ */
+
+user_pref("app.update.auto", false);
+user_pref("app.update.lastUpdateTime.addon-background-update-timer", 1197218150);
+user_pref("app.update.lastUpdateTime.background-update-timer", 1197218149);
+user_pref("app.update.lastUpdateTime.blocklist-background-update-timer", 1197218150);
+user_pref("app.update.lastUpdateTime.search-engine-update-timer", 1197218171);
+user_pref("browser.cache.disk.capacity", 0);
+user_pref("browser.cache.disk.enable", false);
+user_pref("browser.download.useDownloadDir", false);
+user_pref("browser.preferences.advanced.selectedTabIndex", 0);
+user_pref("browser.shell.checkDefaultBrowser", false);
+user_pref("browser.startup.homepage", "http://check.torproject.org/");
+user_pref("browser.startup.homepage_override.mstone", "rv:1.8.1.11");
+user_pref("extensions.lastAppVersion", "2.0.0.11");
+user_pref("extensions.update.notifyUser", false);
+user_pref("intl.charsetmenu.browser.cache", "UTF-8");
+user_pref("network.cookie.prefsMigrated", true);
+user_pref("network.proxy.socks", "localhost");
+user_pref("network.proxy.socks_port", 9050);
+user_pref("network.proxy.socks_remote_dns", true);
+user_pref("network.proxy.type", 1);
+user_pref("urlclassifier.tableversion.goog-black-enchash", "1.39838");
+user_pref("urlclassifier.tableversion.goog-black-url", "1.16802");
+user_pref("urlclassifier.tableversion.goog-white-domain", "1.23");
+user_pref("urlclassifier.tableversion.goog-white-url", "1.371");

Added: torpedo/trunk/build-scripts/vidalia.conf
===================================================================
--- torpedo/trunk/build-scripts/vidalia.conf	                        (rev 0)
+++ torpedo/trunk/build-scripts/vidalia.conf	2007-12-09 20:06:09 UTC (rev 12748)
@@ -0,0 +1,30 @@
+[General]
+InterfaceStyle=Plastique
+RunTorAtStart=true
+ShowMainWindowAtStart=true
+BrowserExecutable=.\\FirefoxPortable\\FirefoxPortable.exe
+
+[BandwidthGraph]
+Geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x16\0\0\0\x1d\0\0\x1\x92\0\0\0\xd7\0\0\0\x1a\0\0\0;\0\0\x1\x8e\0\0\0\xd3\0\0\0\0\0\0)"
+
+[ConfigDialog]
+Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x42\0\0\0W\0\0\x2V\0\0\x2\x1c\0\0\0\x46\0\0\0u\0\0\x2R\0\0\x2\x18\0\0\0\0\0\0)
+
+[MainWindow]
+Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x84\0\0\0\xae\0\0\x2H\0\0\x2\x64\0\0\0\x88\0\0\0\xcc\0\0\x2\x44\0\0\x2`\0\0\0\0\0\0)
+
+[MessageLog]
+Geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\xb0\0\0\0\xe8\0\0\x3q\0\0\x3z\0\0\0\xb4\0\0\x1\x6\0\0\x3m\0\0\x3v\0\0\0\0\0\0)
+
+[NetViewer]
+Geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x16\0\0\0\x1d\0\0\x3i\0\0\x2 \0\0\0\x1a\0\0\0;\0\0\x3\x65\0\0\x2\x1c\0\0\0\0\0\0)"
+
+[Server]
+Changed=true
+ExitPolicy=
+
+[Tor]
+ControlPassword=t{$^6dn0u\"'*6oHN
+ControlPort=9051
+TorExecutable=.\\PortableTor\\App\\tor.exe
+Torrc=.\\PortableTor\\Data\\Tor\\torrc
\ No newline at end of file



More information about the tor-commits mailing list