Browse code

Rename iceweasel-wrapper to browser-wrapper.

This script remains strongly focused on Firefox, but it now lets users specify
the path to the browser that must be launched through configuration files and
environment variables.

Xavier G authored on 26/02/2016 12:21:29
Showing 1 changed files

1 1
similarity index 74%
2 2
rename from bin/iceweasel-wrapper
3 3
rename to bin/browser-wrapper
... ...
@@ -22,6 +22,22 @@ function mk_dir {
22 22
 			"Unable to chmod the following directory, aborting: ${path}"
23 23
 }
24 24
 
25
+# This script may rely on its invoked name to fetch extra configuration
26
+# directives.
27
+invoked_name="$(basename "${0}")"
28
+
29
+# By default, invoke "firefox":
30
+browser_path='firefox'
31
+
32
+# Let users override this through "configuration files":
33
+generic_config_path="${HOME}/.config/browser-wrapper/main.conf"
34
+[ -f "${generic_config_path}" ] && source "${generic_config_path}"
35
+specific_config_path="${HOME}/.config/browser-wrapper/${invoked_name}.conf"
36
+[ -f "${specific_config_path}" ] && source "${specific_config_path}"
37
+
38
+# Let users override this again through an environment variable:
39
+[ -n "${BW_BROWSER_PATH}" ] && browser_path="${BW_BROWSER_PATH}"
40
+
25 41
 if [ -x "$(which proot)" ]; then
26 42
 	echo "proot is present and will be used to mask some directories"
27 43
 
... ...
@@ -55,7 +71,7 @@ if [ -x "$(which proot)" ]; then
55 71
 		-b "${upload_dir}:${HOME}/Uploads" \
56 72
 		-b "${tmp_dir}:/tmp" \
57 73
 		-b "/dev/null:/sys" \
58
-		iceweasel "$@"
74
+		"${browser_path}" "$@"
59 75
 else
60 76
 	echo "proot is missing; the browser will NOT be launched"
61 77
 	exit 127