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:
		
							parent
							
								
									df9ac23760
								
							
						
					
					
						commit
						37b14e3c8b
					
				
					 1 changed files with 17 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue