📜 ⬆️ ⬇️

Firefox and RamDisk. Automation, backup and auto-update

After writing a topic about using Google Chrome on ramdisk, I received several requests to do the same for Firefox.

So ... After a week of tests, I post the recipe for using Fox on the ramdisk.

Installation


We again need:
nnCron , nnBackup (be sure to register!), WinRAR , Gavotte Ramdisk , Wget , more RAM.
')
We install all this stuff and create a ramdisk R: \.

Training


For starters, Fox needs to close :)
In the address bar of the explorer we write:% AppData% \ Mozilla \ Firefox \ Profiles, press Enter and open the folder with your profile.
Copy from the folder with the profile all the files in D: \ Backup \ Firefox \ Profile.
Open the% AppData% \ Mozilla \ Firefox \ profiles.ini file, delete everything from there, and paste this text:
[General]
StartWithLastProfile = 1

[Profile0]
Name = Default User
IsRelative = 0
Path = R: \ Firefox \ Profile
Default = 1

(although you can not insert it, the script will do it itself after a while)

Everything, the profile is successfully transferred.

Some settings in the user.js file:

//
user_pref("browser.cache.disk.enable", true); // ..
user_pref("browser.cache.disk.capacity", 65535); // .. 64 . , :)
user_pref("browser.cache.memory.enable", false); //
user_pref("browser.cache.offline.enable", false); // , :)
user_pref("browser.turbo.enabled", false); // - . .
user_pref("config.trim_on_minimize", false); // . . 7

//
user_pref("app.update.auto", true); //
user_pref("app.update.enabled", false); //
user_pref("app.update.mode", 1); // ,
user_pref("app.update.silent", true); //
user_pref("browser.search.update", true); //
user_pref("extensions.update.enabled", true); //
user_pref("extensions.update.notifyUser", false); //


What else? Who knows what parameters can still be changed, write in the comments.

Scripts


Now we undertake nnCron. In the crown, nothing complicated to do. All you need to do is just copy the ini.spf plugin to the folder with the C: \ Program Files \ nnCron \ plugins plugins, and connect it via the tray menu: Settings> Plugins> Add.
And the most important thing is to install the scripts.

Launch


Run the first script - Loading_Firefox_into_RamDisk. A working copy of Fox will be created on the ramdisk, from there you can make shortcuts to the desktop and the quick launch panel.
This script will also load Firefox onto the ramdisk when logging in. Initially, everything will load, except for the cache and the executable file firefox.exe. I did this so that I would not run Fox until all the files had been copied.
Then firefox.exe is copied, after which you can start the browser, the cache will be loaded already parallel to the surfing.

#( Loading_Firefox_into_RamDisk
AsLoggedUser
SingleInstance
WatchLogon: "*"
Action:
SWHide
StartIn: "C:\Program Files\nnBackup\"
START-APPW: nnbackup.exe sync -i D:\BackUp\Firefox -o R:\Firefox -s -c -x firefox.exe -dx Cache
FILE-WRITE: "%AppData%\Mozilla\Firefox\profiles.ini" "[General]%crlf%StartWithLastProfile=1%crlf%%crlf%[Profile0]%crlf%Name=Default User%crlf%IsRelative=0%crlf%Path=R:\Firefox\Profile%crlf%Default=1"
S" R:\Firefox\Profile\compatibility.ini" INI-FILENAME
S" Compatibility" INI-SECTION
S" LastPlatformDir" S" R:\Firefox\App" INI-SET-VALUE
S" LastAppDir" S" R:\Firefox\App" INI-SET-VALUE
START-APP: nnbackup.exe sync -i D:\BackUp\Firefox\App -o R:\Firefox\App -c -m firefox.exe
START-APP: nnbackup.exe sync -i D:\BackUp\Firefox\Profile\Cache -o R:\Firefox\Profile\Cache -c
)#


Backup


Our backup is incremental, so it's very fast :) From ramdisk, Fox will back up every hour when it closes. It's all elementary: back up a profile without a cache, then a cache (a profile is more valuable! :))

#( BackUp_Firefox
AsLoggedUser
SingleInstance
WatchProcStop: "firefox.exe"
Rule: PROC-EXIST: "firefox.exe" NOT
Action:
SWHide IdlePriority
AsService
StartIn: "C:\Program Files\nnBackup\"
FILE-WRITE: "%AppData%\Mozilla\Firefox\profiles.ini" "[General]%crlf%StartWithLastProfile=1%crlf%%crlf%[Profile0]%crlf%Name=Default User%crlf%IsRelative=0%crlf%Path=R:\Firefox\Profile%crlf%Default=1"
S" R:\Firefox\Profile\compatibility.ini" INI-FILENAME
S" Compatibility" INI-SECTION
S" LastPlatformDir" S" R:\Firefox\App" INI-SET-VALUE
S" LastAppDir" S" R:\Firefox\App" INI-SET-VALUE
START-APPW: nnbackup.exe sync -i R:\Firefox -o D:\BackUp\Firefox -s -ad -c -dx Cache
START-APP: nnbackup.exe sync -i R:\Firefox\Profile\Cache -o D:\BackUp\Firefox\Profile\Cache -ad -da -c
)#

#( BackUp_Firefox_One_Hour
AsLoggedUser
SingleInstance
Time: 0 * * * * *
Action: BackUp_Firefox RUN
)#


Update


Firefox will be updated twice a week, and the script will retrieve files for updating from nightly builds.
You can use the following folders:

latest-electrolysis /
latest-firefox-3.0.x-l10n /
latest-firefox-3.0.x /
latest-firefox-3.5.x-l10n /
latest-firefox-3.5.x /
latest-mozilla-1.9.1-l10n /
latest-mozilla-1.9.1 /
latest-mozilla-1.9.2-l10n /
latest-mozilla-1.9.2 /
latest-mozilla-central-l10n /
latest-mozilla-central /
latest-mozilla1.9.0-l10n /
latest-mozilla1.9.0 /
latest-places /
latest-tracemonkey /
latest-trunk /

The script should pick up a link from any of these folders.

Before the script, the local variable foxlink is set , in it you will specify the full path to one of the above folders.
Here you right-click on the desired assembly, copy the link, and paste it into the foxlink variable. Entirely, together with the slash "/" at the end (probably, it will be a bit more convenient for you and me).
Who needs the Russian version of Fox, take the link to the folder whose name ends with -l10n.
However, the example below shows everything.

Another variable is dspeed . This is the download speed limiter, in kilobytes. Made to avtoapdeyt did not interfere with the surf / work :)

SET foxlink=http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-1.9.1-l10n/
SET dspeed=256k

#( Update_Firefox
AsLoggedUser
SingleInstance
Time: 0 20 * * 3,7 *
Action:
SWHide IdlePriority
AsService
StartIn: "C:\Program Files\Wget\"
DIR-DELETE: "R:\Updates\Firefox"

START-APPW: wget.exe %foxlink% -PR:\Updates\Firefox\ -c --limit-rate=%dspeed% --wait=2m --tries=60
FILE-EXIST: "R:\Updates\Firefox\index.html" NOT
IF
LOG: "D:\BackUp\update.log" ">> . Firefox [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN

RE-MATCH: "%FILE: R:\Updates\Firefox\index.html%" "/firefox-\d\.\d(\.\d(\d)*)*(\l\d)*pre\.(en-US)|(ru)\.win32\.zip/i"
IF
START-APPW: wget.exe %foxlink%%$0% -PR:\Updates\Firefox\ -c --limit-rate=%dspeed% --wait=2m --tries=60
FILE-EXIST: "R:\Updates\Firefox\%$0%" NOT
IF
DIR-DELETE: "R:\Updates\Firefox"
LOG: "D:\BackUp\update.log" ">> %$0% [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN

START-APPW: WinRAR.exe t R:\Updates\Firefox\%$0% -r -y
ExitCodeProc 0 <>
IF
LOG: "D:\BackUp\update.log" ">> %$0% [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN

START-APPW: WinRAR.exe x R:\Updates\Firefox\%$0% R:\Updates\Firefox\ -y
ExitCodeProc 0 <>
IF
LOG: "D:\BackUp\update.log" ">> %$0% [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
EXIT
THEN
PAUSE: 10000

START-APPW: nnbackup.exe sync -i R:\Updates\Firefox\firefox -o D:\BackUp\Firefox\App -s -ad -c

BEGIN PAUSE: 250 PROC-EXIST: "firefox.exe" NOT UNTIL

FILE-DELETE: "R:\Firefox\App\firefox.exe"
START-APPW: nnbackup.exe sync -i R:\Updates\Firefox\firefox -o R:\Firefox\App -s -ad -c -x firefox.exe
START-APPW: nnbackup.exe -i R:\Updates\Firefox\firefox\firefox.exe -o R:\Firefox\App -c
LOG: "D:\BackUp\update.log" " %$0% [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
DIR-DELETE: "R:\Updates\Firefox"
ELSE
DIR-DELETE: "R:\Updates\Firefox"
LOG: "D:\BackUp\update.log" ">> . Firefox [%FT-CUR FT>DD.MM.YYYY/hh:mm:ss%]"
THEN
)#


The principle of updating is as follows: the page is parsed for the necessary link, the archive is downloaded, checked-unpacked, files in the backup are updated.
If Firefox is running, the script waits for Fox to close, and then updates the files on the ramdisk.

Hint: By pressing the buttons a little, you can easily redo this script to update Thunderbird.

In general, everything works quite stable, but if you encounter difficulties with scripts - write in the comments, I will try to fix them.

UPD: a friend asked for a link to the Linux version: Overclocking Firefox with TmpFS

Source: https://habr.com/ru/post/72463/


All Articles