firefox extension sync — sort of

Categories: General

so i have been plagued with a pain in the ass problem, “how do i keep the same extensions across multiple machines ?”

being the lazy fuck that i am and not looking for an extension that can sync other extensions, i found a half assed way of copying / syncing all extensions to one list.

### backups ###

first thing you want to do is backup your firefox extension files and folder which are located at ~/.mozilla/firefox/<random text>.default/
notice the usage of <random text> ?
this is exactly as listed, it is usually some random string followed by .default.

once you have backed up your initial machine make sure you backup every other machine that you are going to be copying / syncing.

once done with that make a temporary directory with x amount of directories (depending on how many machines you are planning to backup) in which we are going to copy the extension.* files and the extensions/ folder.

### file editing ###

once copied make a master directory in this folder

cat all the extension.cache files to the master extension.cache

create a master extensions.ini file.
we can take the contents of all the backed up extensions.ini and cat them to the master extensions.ini
now lets edit: we are taking the contents located between [ExtensionDirs] & [ThemeDirs] and renumbering so that the numbers are continuous from 0 through whatever the last one happens to be also making sure that the path listed after Extension*= matches the /home/username path and firefox .default directory.
leave the one or two lines after [ThemesDirs] alone – there should only be one line, but make sure that the path that is specified in Extension0 does actually exist.

now we are going to create a master extension.rdfcat the section of the extension.rdf from <?xml version="1.0"?> to the the line right above the first <RDF:Description> from any of the backup extension.rdf to the master.rdf — that should be about 4 lines

now cat all the backup extensions.rdf beginning at the fifth line down to the master extensions.rdf making sure to replace the first instance of </RDF:RDF> with </RDF:Description> since this ends the document (??)

### file copying ###

now create a master extension folder (same folder that your “master” extension.ini, extension.rdf & extension.cache files are located)

copy the contents from all the backup extension folders to the master extension folder

### users ###

at this point change the users of all the files in your master folder to what ever your user is (chown -R extensions/ & chown -R extension.*)

### the big leap ###

since we have our backup copies in our backup directories we can overwrite the master copies in our mozilla folder (.mozilla/firefox/<random text>.default/)

restart firefox from the command line so you can see if there are any errors (making sure to not set it to background "&")
once firefox comes up – go to the add-ons window (tools –> add-ons) and check if your extensions show up, you might have to hit the restart firefox (version specific) at the bottom of add-on window for firefox to give you the information on your extensions.

if there are duplicate extensions or old (deprecated) extensions firefox will alert you right at startup. just follow the directions

### after the mayhem ###

this document will be heavily changed / fixed and so forth
i am also in the process of scripting all this fun stuff, but will probably forget to post it for a while.


    Leave a Reply

    Your email address will not be published. Required fields are marked *