work around profile creation issues in a recent Firefox versions with an ugly hack

This commit is contained in:
Otto Seiskari 2019-11-26 22:04:52 +02:00
parent 2e97d33757
commit e738e875bb
2 changed files with 21 additions and 8 deletions

View File

@ -3,13 +3,6 @@ set -e
COMMAND="$1"
echo "$COMMAND"
# If no profile ...
if [ ! -d "$HOME/.mozilla" ]; then
# create the default Firefox profile and put some settings there
firefox -CreateProfile default
mv $HOME/user.js `find $HOME/.mozilla/firefox -type d | grep .default`
fi
OPENVPN_CONF='/etc/openvpn/openvpn.conf'
if [ -f "$OPENVPN_CONF" ]; then
"$HOME/start-openvpn-blocking.sh" "$OPENVPN_CONF"
@ -31,5 +24,24 @@ if [ ! -z ${ASSERT_COUNTRY+x} ]; then
fi
fi
# Start firefox
# If no profile ...
if [ $COMMAND == "firefox" ]; then
# create the default Firefox profile and put some settings there
firefox &
FIREFOX_PID=$!
# Since some recent Firefox version, calling CreateProfile and copying
# user.js stopped working on the first use for reasons I could not find on
# Google and do not frankly care about. This is the workaround
set +e
while [ `find $HOME/.mozilla/firefox -type f | grep prefs.js | wc -l` == "0" ];
do
echo "... waiting for Firefox to start the first time"
sleep 1
done
set -e
echo "killing Firefox and copying settings"
kill $FIREFOX_PID
mv $HOME/user.js `find $HOME/.mozilla/firefox -maxdepth 1 -type d | grep .default-release`
fi
$COMMAND

1
run.sh
View File

@ -6,6 +6,7 @@ docker run -ti --rm -e DISPLAY \
-v `pwd`/openvpn:/etc/openvpn \
-v `pwd`/shared:/home/user/Downloads \
-e ASSERT_COUNTRY \
--name docker-vpn-browser-container \
--dns 1.1.1.1 \
docker-vpn-browser \
"$@"