diff --git a/src/mobile-config-firefox.sh b/src/mobile-config-firefox.sh index 57be005..842395c 100644 --- a/src/mobile-config-firefox.sh +++ b/src/mobile-config-firefox.sh @@ -12,20 +12,28 @@ prepare_profile() { fi } -profile_found=false -for profiledir in ~/.mozilla/firefox/*/; do - if ! [ -e "$profiledir/prefs.js" ]; then - continue - fi +if [ -e ~/.mozilla/firefox/profiles.ini ]; then + # Firefox was started without this wrapper and created profiles.ini. + # Add the userChrome.css symlink to all existing profiles, then let + # firefox run with the default profile. - prepare_profile "$profiledir" - profile_found=true -done + for profiledir in ~/.mozilla/firefox/*/; do + if ! [ -e "$profiledir/prefs.js" ]; then + continue + fi + + prepare_profile "$profiledir" + done -if [ "$profile_found" = "true" ]; then exec /usr/bin/firefox "$@" else + # Firefox was not started without this wrapper. Create a profile dir + # called "firefox.default" if it does not exist yet, and add the + # userChrome.css symlink. Let firefox use this profile. It will not + # create the profiles.ini file. + profiledir=~/.mozilla/firefox/firefox.default prepare_profile "$profiledir" + exec /usr/bin/firefox --profile "$profiledir" "$@" fi