Firefox Cache Path ändern

Antworten
Benutzeravatar
tmakcom
Beiträge: 8
Registriert: 09 Okt 2008, 14:50
Wohnort: Siegburg
Kontaktdaten:

Firefox Cache Path ändern

Beitrag von tmakcom »

Hallo,

vielleicht kann mir jemand mit folgender Fragestellung weiterhelfen.
In unserer Firma ist es nicht gewünscht, dass der Cache des Firefox im Serverprofil liegt. Daher versuche ich diesen nach C:\Firefox-Cache umzuleiten.
Ich habe die Datei wie folgt angepasst. Die Änderungen und Ergänzungen, die ich vorgenommen habe, habe ich durch die Code-Tags markiert.
Es wird werder das Verzeichnis angelegt, noch der Eintrag in der Firefox-Konfiguration erstellt.
Bin noch recht neu dabei, vielleicht hat jemand einen Tipp.

Viele Grüße
Tilman

; Copyright (c) uib gmbh (http://www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.

[Initial]
LogLevel=2
; Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false

[Aktionen]
DefVar $ProductId$
DefVar $InstallDir$
DefVar $NewExe$
DefVar $PRODUCTPATH$
DefStringList $profiles$
DefVar $akt_profile_ini$
DefVar $rel_prefs_path$
DefVar $akt_prefs_path$
DefVar $TEMP$
DefVar $OS$
DefVar $UninstallCommand$
DefVar $MozInstallDir$
DefVar $MozVersion$
DefVar $MozInstallPathRegKey$
DefVar $PROXY_HOSTNAME_OR_IP$
DefVar $PROXY_PORT$
DefVar $NOPROXY_HOSTS$
DefVar $PREF_FILE$
DefStringList $languageInfo$
DefVar $language$
DefVar $AppData$

Code: Alles auswählen

DefVar $CachePath$
Set $TEMP$ = EnvVar("TEMP")
Set $PRODUCTPATH$="%ProgramFilesDir%\Mozilla Firefox"
set $InstallDir$=$PRODUCTPATH$
set $NewExe$= $PRODUCTPATH$+"\firefox.exe"
set $ProductId$ = "firefox"
set $OS$ = GetNTVersion

Code: Alles auswählen

set $CachePath$ = "C:\FireFox-Cache"
if not(HasMinimumSpace ("%SYSTEMDRIVE%", "100 MB"))
LogError "Nicht gengend Platz auf C: . 100 MB auf C: fuer Firefox erforderlich."
isFatalError
comment "Bearbeitung beenden und Produktschalter auf failed setzen"
else
comment "show product picture"
ShowBitmap /3 "%scriptpath%\firefox.png" "Firefox"

comment "what is the name of the Application Data Dir ?"
set $AppData$ = "\Anwendungsdaten"
DefVar $InterestingFile$
set $InterestingFile$ = "%system%\kernel32.dll"
DefStringList $FileInfo$
set $FileInfo$ = getFileInfoMap($InterestingFile$)
set $language$ = getValue("language name 0", $FileInfo$ )

if $language$ = "Deutsch (Deutschland)"
set $AppData$ = "\Anwendungsdaten"
else
if $language$ = "English (United States)"
set $AppData$ = "\Application Data"
else
comment "Name of Application Data Dir here not defined for "+$language$
endif
endif

if GetNTVersion = "Windows Vista"
set $AppData$ = "\AppData\Roaming"
endif


set $MozVersion$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Firefox] CurrentVersion")
set $MozInstallPathRegKey$ = "[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Firefox\"+$MozVersion$+"\Main]"
set $MozInstallDir$ = GetRegistryStringValue ($MozInstallPathRegKey$+" Install Directory")

if FileExists("%ScriptPath%\delsub.ins")
comment "start uninstall"
sub "%ScriptPath%\delsub.ins"
endif

comment "Message at install time:"
Message=Installing Firefox...
comment "kill a running firefox"
killtask "firefox.exe"

comment "check for depotshare"
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
comment "start setup program"

DefVar $FIREFOXVER$

if (IniVar ("firefox3") = "off")
set $FIREFOXVER$ = "Firefox Setup 2.0.0.20.exe"
else
set $FIREFOXVER$ = "Firefox Setup 3.5.2.exe"
endif
Files_copy_local
Winbatch_firefox

set $MozVersion$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Firefox] CurrentVersion")
comment "if failed - try again"
if ($MozVersion$="")
Winbatch_firefox
endif
set $MozVersion$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Firefox] CurrentVersion")

comment "kill a running firefox"
killtask "firefox.exe"

if not(FileExists($NewExe$))
logError("Fatal: After Installation "+$NewExe$+" not found")
isFatalError
endif

comment "del temporary files"
Files_del

comment "now we do the customizing"
comment "should we patch user.js or prefs.js ?"
set $PREF_FILE$ = IniVar("pref_file")
set $PREF_FILE$ = $PREF_FILE$+".js"

Code: Alles auswählen

 if (IniVar("NoAutoUpdate") = "on") or (IniVar("ChachePath") = "on") or ((IniVar("SetProxy") = "off") or not(IniVar("SetProxy") = "")) 
comment "there is something to customize"
comment "now we patch the default profiles"

Code: Alles auswählen

  if (IniVar("ChachePath") = "on")
	dosbatch_cachedir
	PatchTextFile_profile_firefoxcachepath $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
  endif
if (IniVar("NoAutoUpdate") = "on")
if FileExists ($PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$)
PatchTextFile_profile_noautoupdate $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
endif
if FileExists ($PRODUCTPATH$+"\defaults\pref\firefox.js")
PatchTextFile_profile_noautoupdate $PRODUCTPATH$+"\defaults\pref\firefox.js"
endif
endif
if not(((IniVar("SetProxy") = "off") or (IniVar("SetProxy") = "")))
set $NOPROXY_HOSTS$ = IniVar("noproxy_hosts")
if (IniVar("SetProxy") = "direct")
if FileExists ($PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$)
PatchTextFile_profile_proxy_direct $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
endif
if FileExists ($PRODUCTPATH$+"\defaults\pref\firefox.js")
PatchTextFile_profile_proxy_direct $PRODUCTPATH$+"\defaults\pref\firefox.js"
endif
endif
if (
("SetProxy") = "manual")
set $PROXY_HOSTNAME_OR_IP$ = IniVar("Proxysetting")
set $PROXY_PORT$ = takeString(1,splitString($PROXY_HOSTNAME_OR_IP$,":"))
set $PROXY_HOSTNAME_OR_IP$ = takeString(0,splitString($PROXY_HOSTNAME_OR_IP$,":"))
if FileExists ($PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$)
PatchTextFile_profile_proxy_manual $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
endif
if FileExists ($PRODUCTPATH$+"\defaults\pref\firefox.js")
PatchTextFile_profile_proxy_manual $PRODUCTPATH$+"\defaults\pref\firefox.js"
endif
endif
if (IniVar("SetProxy") = "file")
set $PROXY_HOSTNAME_OR_IP$ = IniVar("Proxysetting")
if FileExists ($PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$)
PatchTextFile_profile_proxy_file $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
endif
if FileExists ($PRODUCTPATH$+"\defaults\pref\firefox.js")
PatchTextFile_profile_proxy_file $PRODUCTPATH$+"\defaults\pref\firefox.js"
endif
endif
endif
comment "now we patch the existing user profiles"
comment "get user directories via dosbatch dir command"
Set $profiles$ = getOutStreamFromSection ('dosbatch_profiledir')
comment "loop over the result"
for $x$ in $profiles$ do sub_patch_prefs_file
else
comment "there is nothing to customize"
endif

comment "custom specific stuff"
if FileExists("%ScriptPath%\custom_ins_dir\custom.ins")
sub "%ScriptPath%\custom_ins_dir\custom.ins"
endif
endif


[Files_copy_local]
copy -x "%SCRIPTPATH%\$FIREFOXVER$" c:\tmp

[Files_del]
delete -f "c:\tmp\$FIREFOXVER$"

[Winbatch_firefox]
; see http://wiki.mozilla.org/Installer:Comma ... _Arguments
"c:\tmp\$FIREFOXVER$" /INI=%SCRIPTPATH%\ff_silent_setup.ini

[Winbatch_firefox2]
; see http://wiki.mozilla.org/Installer:Comma ... _Arguments
"%SCRIPTPATH%\Firefox Setup 2.0.0.20.exe" /S
; If you want to configure:
; "%SCRIPTPATH%\Firefox Setup 2.0.0.20.exe" /INI=%SCRIPTPATH%\ff_silent_setup.ini

[Winbatch_firefox3]
"%SCRIPTPATH%\Firefox Setup 3.5.2.exe" /INI=%SCRIPTPATH%\ff_silent_setup.ini

[dosbatch_profiledir]
@echo off
dir "%ProfileDir%" /b

[sub_patch_prefs_file]
Set $akt_profile_ini$ = "%ProfileDir%\"+"$x$"+$AppData$+"\Mozilla\Firefox\profiles.ini"
if FileExists($akt_profile_ini$)
Set $rel_prefs_path$ = GetIni ($akt_profile_ini$ [Profile0] Path)
Set $akt_prefs_path$ = "%ProfileDir%\"+"$x$"+$AppData$+"\Mozilla\Firefox\"+$rel_prefs_path$
if FileExists($akt_prefs_path$+"\"+$PREF_FILE$)
if (IniVar("NoAutoUpdate") = "on")
PatchTextFile_profile_noautoupdate $akt_prefs_path$+"\"+$PREF_FILE$
endif

Code: Alles auswählen

  if (IniVar("ChachePath") = "on")
	dosbatch_cachedir
	PatchTextFile_profile_firefoxcachepath $akt_prefs_path$+"\"+$PREF_FILE$
  endif
if not(((IniVar("SetProxy") = "off") or (IniVar("SetProxy") = "")))
if (IniVar("SetProxy") = "direct")
PatchTextFile_profile_proxy_direct $akt_prefs_path$+"\"+$PREF_FILE$
endif
if (IniVar("SetProxy") = "manual")
set $PROXY_HOSTNAME_OR_IP$ = IniVar("Proxysetting")
set $PROXY_PORT$ = takeString(1,splitString($PROXY_HOSTNAME_OR_IP$,":"))
set $PROXY_HOSTNAME_OR_IP$ = takeString(0,splitString($PROXY_HOSTNAME_OR_IP$,":"))
PatchTextFile_profile_proxy_manual $akt_prefs_path$+"\"+$PREF_FILE$
endif
if (IniVar("SetProxy") = "file")
set $PROXY_HOSTNAME_OR_IP$ = IniVar("Proxysetting")
PatchTextFile_profile_proxy_file $akt_prefs_path$+"\"+$PREF_FILE$
endif
endif
endif
endif

Code: Alles auswählen

[DosBatch_cachedir]
if not exist "%CachePath%" md "%CachePath%"
[PatchTextFile_profile_noautoupdate]
Set_Netscape_User_Pref ("app.update.enabled", false)

[DosInAnIcon_TryToReconnect]
net use
set TIMEOUT=
:TRY
if exist "%SCRIPTPATH%\." goto READY
%ScriptDrive%
set TIMEOUT=%TIMEOUT%1
if %TIMEOUT% == 1111111111111111 goto READY
sleep 1
net use
goto TRY
:READY

[PatchTextFile_profile_proxy_direct]
Set_Netscape_User_Pref ("network.proxy.type", 0);

[PatchTextFile_profile_proxy_manual]
Set_Netscape_User_Pref ("network.proxy.type", 1);
Set_Netscape_User_Pref ("network.proxy.backup.ftp", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.backup.ftp_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.backup.gopher", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.backup.gopher_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.backup.socks", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.backup.socks_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.backup.ssl", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.backup.ssl_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.ftp", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.ftp_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.gopher", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.gopher_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.socks", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.socks_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.http", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.http_port", $PROXY_PORT$);
Set_Netscape_User_Pref ("network.proxy.no_proxies_on", "$NOPROXY_HOSTS$");
Set_Netscape_User_Pref ("network.proxy.share_proxy_settings", true);
Set_Netscape_User_Pref ("network.proxy.ssl", "$PROXY_HOSTNAME_OR_IP$");
Set_Netscape_User_Pref ("network.proxy.ssl_port", $PROXY_PORT$);

[PatchTextFile_profile_proxy_file]
Set_Netscape_User_Pref ("network.proxy.type", 2);
Set_Netscape_User_Pref ("network.proxy.autoconfig_url", "file:///$PROXY_HOSTNAME_OR_IP$");

Code: Alles auswählen

[PatchTextFile_profile_firefoxcachepath]
Set_Netscape_User_Pref ("browser.cache.disk.parent_directory","$CachePath$");
matth46
Beiträge: 172
Registriert: 22 Jun 2009, 19:48

Re: Firefox Cache Path ändern

Beitrag von matth46 »

Typo.

Code: Alles auswählen

ChachePath =! CachePath
somit wird bei Prüfung mittels

Code: Alles auswählen

if (IniVar("ChachePath") = "on")
   dosbatch_cachedir
   PatchTextFile_profile_firefoxcachepath $PRODUCTPATH$+"\defaults\profile\"+$PREF_FILE$
  endif
"dosbatch_cachedir" und "PatchTextFile_..." nicht ausgeführt, da die Variable "ChachePath" nicht definiert ist.
Benutzeravatar
tmakcom
Beiträge: 8
Registriert: 09 Okt 2008, 14:50
Wohnort: Siegburg
Kontaktdaten:

Re: Firefox Cache Path ändern

Beitrag von tmakcom »

Ahhh...to blind to see :roll:
Jetzt funktioniert alles perfekt.

Vielen lieben Dank!
Tilman
Antworten