firefox logic in /usr/local/bin/defaultbrowser

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

firefox logic in /usr/local/bin/defaultbrowser

#1 Post by s243a »

Puppylinux uses the following command for the default browser:

Code: Select all

#!/bin/ash
exec mozstart "$@"
/usr/local/bin/defaultbrowser

mozstart doesn't seem to be defined in woofCE. Anyway, I chose for TazPup64 to use defaultbrowser as a way of defining browser preferences.

Code: Select all

if [ "$TEXTDOMAIN" = 'tazpanel' ]; then
  BROWSER_CHOICES=( tazweb midori palemoon firefox opera iron chomium chrome netsurf lynx )
else
  BROWSER_CHOICES=( opera palemoon firefox tazweb midori iron chomium chrome netsurf lynx )
fi
https://pastebin.com/aw5xBEWL
When "$TEXTDOMAIN" = 'tazpanel' then we call a lightweight browser, otherwise we call a full featured browser.

What I want to focus on here is the seciton for firefox:

Code: Select all

for  BROWSER_OPTION in "${BROWSER_CHOICES[@]}"; do  
  case "$BROWSER_OPTION" in
...
  firefox*)
...
    elif [ ! -z `which "$BROWSER_OPTION"` ]; then #we expect $BROWSER_OPTION to be either firefox or firefox-official
      CMD="$BROWSER_OPTION"
    elif [ ! -z "which firefox" ]; then
      CMD=firefox
    else
      continue
    fi
    if [ -h "$CMD" ]; then
      CMD=`readlink "$CMD"`
    fi
    if [ ! -z "`which apulse`" ] && [ $(file $CMD | grep -c ELF ) -gt 0 ]; then
      CMD="apulse $CMD"
    fi    
    exec $CMD "$@"
    ;;
https://pastebin.com/aw5xBEWL

The idea here is that if BROWSER_OPTION points to a binary and apulse exists in the system then we call firefox with apulse, otherwise we assume that the script which the command points to decides properly whether or not apulse is needed.

Post Reply