2
|
1 Profile Management with Firefox (and other?)
|
|
2 ============================================
|
|
3
|
|
4
|
|
5 Desired Functionality
|
|
6 ---------------------
|
|
7
|
|
8 See https://wiki.mozilla.org/Auto-tools/Projects/ProfileManager and
|
|
9 https://bugzilla.mozilla.org/show_bug.cgi?id=539524 :
|
|
10
|
|
11 - backing up profile
|
|
12
|
|
13 - merging
|
|
14
|
|
15
|
|
16 profiles.ini
|
|
17 ------------
|
|
18
|
|
19 A typical `.mozilla/firefox/profiles.ini` is as follows:
|
|
20
|
|
21 {{{
|
|
22 [General]
|
|
23 StartWithLastProfile=0
|
|
24
|
|
25 [Profile0]
|
|
26 Name=default
|
|
27 IsRelative=1
|
|
28 Path=py91jfha.default
|
|
29 Default=1
|
|
30
|
|
31 [Profile1]
|
|
32 Name=Lammy
|
|
33 IsRelative=1
|
|
34 Path=nr0eq10m.Lammy
|
|
35 }}}
|
|
36
|
|
37 Notes:
|
|
38
|
|
39 - why use identifiers `[Profile0]`, `[Profile1]`, etc instead of the
|
|
40 actual names ( `[default]`, `[lammy]` )?
|
|
41
|
|
42 - Instead of `Default=1` or `0`, could indicate the version of
|
|
43 Firefox for which the profile is the default (e.g. `Default=3.6`)
|
|
44
|
|
45
|
|
46 Architecture
|
|
47 ------------
|
|
48
|
|
49 The architecture should satisfy both user-facing applications
|
|
50 (i.e. the Firefox ProfileManager) as well as be friendly and malleable
|
|
51 for testing purposes (e.g. a command line application). All front
|
|
52 ends (GUI, command-line, web???, etc) should use the same underlying
|
|
53 API, which will be front-end agnostic.
|
|
54
|
|
55 API
|
|
56 ---
|
|
57
|
|
58 class ProfileManager(object):
|
|
59
|
|
60 def __init__(self, profiles):
|
|
61 """
|
|
62 profiles: profiles.ini file
|
|
63 """
|
|
64
|
|
65 def clone(self, from, to):
|
|
66 """
|
|
67 clones the profile `from` and output to `to`
|
|
68 """
|
|
69
|
|
70 def backup(self, profile):
|
|
71 """
|
|
72 backs up the profile named `profile`;
|
|
73 maybe should be named `snapshot`
|
|
74 """
|
|
75
|
|
76 def merge(self, *profiles):
|
|
77 """merge a set of profiles (not trivial!)"""
|
|
78
|
|
79 Command Line Interface
|
|
80 ----------------------
|
|
81
|
|
82 The command line interface should mirror the API.
|
|
83
|
|
84 Options:
|
|
85 -c CONFIG, --config=CONFIG specify a profiles.ini file
|
|
86 [default: $HOME/.mozilla/firefox/profiles.ini]
|
|
87
|
|
88 Examples:
|
|
89
|
|
90 `profile-manager clone lammy foo # clone the lammy profile to foo`
|
|
91
|
|
92 `profile-manager backup lammy # make a snapshot of the lammy profile`
|
|
93
|
|
94
|
|
95 Questions
|
|
96 ---------
|
|
97
|
|
98 How to generate the hash key? (e.g. the `py91jfha` in `py91jfha.default`)
|