-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprivatefox.sh
executable file
·44 lines (33 loc) · 983 Bytes
/
privatefox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
CONFIG=$HOME/.privatefox
# create directories if not exist
mkdir -p $CONFIG/profile.encrypted $CONFIG/profile
# check if already mounted
findmnt $CONFIG/profile
# throw when profile already mounted
if [ $? == 0 ]; then
zenity --error --width 200 --text "Privatefox profile directory already mounted!"
exit 1
fi
# read password
password=$(zenity --password)
# throw when password empty
if [ -z $password ]; then
zenity --error --width 200 --text "Password cannot be empty!"
exit 1
fi
# decrypt
echo $password | encfs $CONFIG/profile.encrypted $CONFIG/profile -S --standard
# throw when mounting fails
if [ $? != 0 ]; then
zenity --error --width 200 --text "Error. Check your password!"
exit 1
fi
# start firefox
firefox --profile $CONFIG/profile --new-instance $@
# unmount/decrypt profile
fusermount -u $CONFIG/profile
# throw when unmounting fails
if [ $? != 0 ]; then
zenity --error --width 200 --text "Error unmounting Privatefox profile!"
fi