Because we preprocess git-web--browse.sh to create the final git-web--browse to be installed, something like "open" that is not a user but a platform preference might be better done as a build-time thing, instead of forcing everybody to spawn "uname", perhaps like this? Also I wonder why the check for SECURITYSESSIONID your original had is not good enough for this Mac specific customization? Makefile | 2 ++ git-web--browse.sh | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index d288378..5c278d2 100644 --- a/Makefile +++ b/Makefile @@ -419,6 +419,7 @@ ifeq ($(uname_S),Darwin) endif NO_STRLCPY = YesPlease NO_MEMMEM = YesPlease + PLATFORM_BROWSER = open endif ifeq ($(uname_S),SunOS) NEEDS_SOCKET = YesPlease @@ -840,6 +841,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ + -e 's/@@PLATFORM_BROWSER@@/$(PLATFORM_BROWSER)/g' \ $@.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ diff --git a/git-web--browse.sh b/git-web--browse.sh index 3ade500..61a3514 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -27,6 +27,8 @@ valid_tool() { case "$1" in firefox | iceweasel | konqueror | w3m | links | lynx | dillo) ;; # happy + "@@PLATFORM_BROWSER@@" ) + ;; *) return 1 ;; @@ -105,6 +107,20 @@ if test -z "$browser" ; then browser_candidates="w3m links lynx" fi + # Test if the current environment is suitable for the + # platform preference and add it as the default + + if case "@@PLATFORM_BROWSER@@" in + open) + test -n "$SECURITYSESSIONID" ;; + # other platform preference come here... + *) + false ;; + esac + then + browser_candidates="@@PLATFORM_BROWSER@@ $browser_candidates" + fi + for i in $browser_candidates; do init_browser_path $i if type "$browser_path" > /dev/null 2>&1; then @@ -147,7 +163,7 @@ case "$browser" in ;; esac ;; - w3m|links|lynx) + w3m|links|lynx|open) eval "$browser_path" "$@" ;; dillo) - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html