om@5
|
1 |
#!/bin/bash
|
om@5
|
2 |
|
om@5
|
3 |
# create a disposable firefox session
|
om@5
|
4 |
#
|
om@5
|
5 |
# Remark: this script expects the firefox sessions
|
om@6
|
6 |
# to be stored in ~/.mozilla/firefox
|
om@5
|
7 |
#
|
om@5
|
8 |
|
om@5
|
9 |
# pick the next profile number
|
om@5
|
10 |
PROFILE_NUMBER=$(new_firefox_profile_id.py)
|
om@5
|
11 |
PROFILE_PATH=$(basename $(mktemp -d ~/.mozilla/firefox/XXXXXXXX.os_user_${PROFILE_NUMBER}))
|
om@5
|
12 |
PROFILE_TIMESTAMP="$(date +%s)000"
|
om@5
|
13 |
PROFILE_NAME=$(echo ${PROFILE_PATH} | awk -F '.' '{ print $NF; }')
|
om@5
|
14 |
|
om@5
|
15 |
# create a fake times.json
|
om@6
|
16 |
cat > ~/.mozilla/firefox/${PROFILE_PATH}/times.json << __EO_TIMES_JSON__
|
om@5
|
17 |
{
|
om@5
|
18 |
"created": ${PROFILE_TIMESTAMP}
|
om@5
|
19 |
}
|
om@5
|
20 |
__EO_TIMES_JSON__
|
om@5
|
21 |
|
om@6
|
22 |
# add our new "profile" to firefox
|
om@5
|
23 |
cat >> ~/.mozilla/firefox/profiles.ini << __EO_PROFILES_INI__
|
om@5
|
24 |
[Profile${PROFILE_NUMBER}]
|
om@5
|
25 |
Name=${PROFILE_NAME}
|
om@5
|
26 |
IsRelative=1
|
om@5
|
27 |
Path=${PROFILE_PATH}
|
om@5
|
28 |
|
om@5
|
29 |
__EO_PROFILES_INI__
|
om@5
|
30 |
|
om@5
|
31 |
|
om@5
|
32 |
# launch firefox
|
om@5
|
33 |
firefox -P ${PROFILE_NAME} -no-remote $@
|