:.: firefox volatile profile

Usually I use rdomain(4) with my VPN on OpenBSD so when I use my browser (firefox) on my daily basis I never start it with route -T1 exec, so for example if I need to access my router on 192.168.1.1 it is a bit of a pain in the ass to RE-open firefox (killing all the tabs and so on) with route -T1 exec.

To not force it and don't open or install another browser what I usually do is create a temporary directory with a profile for firefox with the private mode on, the commands I use are the follow:

$ export PROFILE=$(mktemp -d /tmp/ff-XXXXXXX)
$ route -T1 exec firefox -private -private-toggle -profile ${PROFILE} ; rm -rf ${PROFILE}

That is pretty much all, after you close the browser it will delete the temporary profile and all done. If you put it all together in a script, will look like:

$ cat bin/firefox_clean
#!/bin/sh

PROFILE=$(mktemp -d /tmp/ff-XXXXXXX)

export DISPLAY=:0.0
TZ=UTC route -T1 exec firefox -private -private-toggle -profile ${PROFILE}

rm -rf ${PROFILE}

You might want to adjust the table if you use another one, if you want to have a clean firefox each time you can just skip the rdomain(4) and lie about your timezone, you can even make this profile directory part of a virtual memory and go to another level. Anyway a lot of fun.