wrapper: fix second start with wrong profile

Always start with --profile if there is no profiles.ini. Otherwise,
firefox will create and use the profile for the first start only, but
not set it as default. It would create a new profile on the second start
then.
This commit is contained in:
Oliver Smith 2020-08-10 11:41:29 +02:00
parent df9ac23760
commit 37b14e3c8b
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -12,20 +12,28 @@ prepare_profile() {
fi fi
} }
profile_found=false if [ -e ~/.mozilla/firefox/profiles.ini ]; then
for profiledir in ~/.mozilla/firefox/*/; do # Firefox was started without this wrapper and created profiles.ini.
if ! [ -e "$profiledir/prefs.js" ]; then # Add the userChrome.css symlink to all existing profiles, then let
continue # firefox run with the default profile.
fi
prepare_profile "$profiledir" for profiledir in ~/.mozilla/firefox/*/; do
profile_found=true if ! [ -e "$profiledir/prefs.js" ]; then
done continue
fi
prepare_profile "$profiledir"
done
if [ "$profile_found" = "true" ]; then
exec /usr/bin/firefox "$@" exec /usr/bin/firefox "$@"
else 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 profiledir=~/.mozilla/firefox/firefox.default
prepare_profile "$profiledir" prepare_profile "$profiledir"
exec /usr/bin/firefox --profile "$profiledir" "$@" exec /usr/bin/firefox --profile "$profiledir" "$@"
fi fi