aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2005-03-29 16:26:53 +0000
committerFrederic Lepied <flepied@mandriva.com>2005-03-29 16:26:53 +0000
commitc0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14 (patch)
treee00b880d762fb220c3036b1be1d0f070919dbe77
parentf4e9db9fa2cf718e73738dd21abea4b89eca58ef (diff)
downloadcommon-data-c0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14.tar
common-data-c0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14.tar.gz
common-data-c0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14.tar.bz2
common-data-c0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14.tar.xz
common-data-c0eb1536fb5ad5d6c5aa0177a6f6bf3f56057d14.zip
test if the $BROWSER variable is set to something valid (bug #14903).
-rwxr-xr-xbin/www-browser33
1 files changed, 20 insertions, 13 deletions
diff --git a/bin/www-browser b/bin/www-browser
index b4539d0..fb37d0f 100755
--- a/bin/www-browser
+++ b/bin/www-browser
@@ -10,11 +10,16 @@
#---------------------------------------------------------------
strip_browser_var() {
-if [[ -n "$BROWSER" ]]; then
- if [[ `basename "$BROWSER"` == "www-browser" ]]; then
- unset BROWSER
- fi
-fi
+ if [[ -n "$BROWSER" ]]; then
+ if [[ `basename "$BROWSER"` == "www-browser" ]]; then
+ unset BROWSER
+ else
+ set $BROWSER
+ if ! which $1 > /dev/null 2>&1; then
+ unset BROWSER
+ fi
+ fi
+ fi
}
strip_browser_var
@@ -24,7 +29,7 @@ if [[ -z "$BROWSER" ]]; then
if [[ -n "$GNOME_DESKTOP_SESSION_ID" ]]; then
BROWSER=`gconftool -g /desktop/gnome/url-handlers/http/command | sed -e 's/ %s//'`
if [[ `gconftool -g /desktop/gnome/url-handlers/http/needs_terminal` == "true" ]]; then
- BROWSER="xvt -e $BROWSER"
+ BROWSER="xvt -e $BROWSER"
fi
fi
@@ -33,24 +38,26 @@ if [[ -z "$BROWSER" ]]; then
NEWBROWSER=`grep -m 1 'BrowserApplication=' $HOME/.kde/share/config/kdeglobals 2>/dev/null`
[[ -z "$NEWBROWSER" ]] && NEWBROWSER=`grep -m 1 'BrowserApplication=' /etc/kde/kdeglobals 2>/dev/null`
if [[ -n "$NEWBROWSER" ]]; then
- BROWSER=`echo $NEWBROWSER | sed -e 's/BrowserApplication=//' -e 's/!//'`
+ BROWSER=`echo $NEWBROWSER | sed -e 's/BrowserApplication=//' -e 's/!//'`
fi
- [[ -z "$BROWSER" ]] && which kfmclient 2> /dev/null && BROWSER="kfmclient openProfile webbrowsing"
+ [[ -z "$BROWSER" ]] && which kfmclient > /dev/null 2>&1 && BROWSER="kfmclient openProfile webbrowsing"
fi
- strip_browser_var
-
+ strip_browser_var
+
[[ -z "$BROWSER" ]] && BROWSER=`which mozilla-firefox 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which epiphany 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which galeon 2> /dev/null`
[[ -z "$BROWSER" ]] && BROWSER=`which mozilla 2> /dev/null`
- [[ -z "$BROWSER" ]] && which kfmclient 2> /dev/null && BROWSER="kfmclient openProfile webbrowsing"
+ [[ -z "$BROWSER" ]] && which kfmclient > /dev/null 2>&1 && BROWSER="kfmclient openProfile webbrowsing"
+ [[ -z "$BROWSER" ]] && which links > /dev/null 2>&1 && BROWSER="xvt -e links"
+ [[ -z "$BROWSER" ]] && which lynx > /dev/null 2>&1 && BROWSER="xvt -e lynx"
fi
if [[ -n "$BROWSER" ]]; then
- exec $BROWSER "$@"
+ exec $BROWSER "$@"
else
- echo "no web browser detected"
+ echo "no web browser detected"
fi
# www-browser ends here