[Slackbuilds-users] Features in chromium slackbuild

Yucatan "Kenjiro" Costa jedi.kenjiro at gmail.com
Fri Dec 9 11:21:32 UTC 2011


Hello there.

I forward a message I got from a fellow chrom[e|ium] user to see if more
people would like this feature (--temp-profile) present in the script which
launches chromium.

I never used such thing, so I wasn't aware of it until today *grin*.

What do you say? Should we have it?



---------- Forwarded message ----------
From: higuita
Date: Wed, Dec 7, 2011 at 10:51 PM
Subject: chromium slackbuild
To: jedi.kenjiro at gmail.com


Hi

       Thanks for your chromium slackbuild!

       One thing i'm missing is the support for the --temp-profile, to
load chromium on a temporary profile and removed it in the end (useful
for test webpages without any cache)

       So i grabbed the debian script and tuned it for slackware...
i'm sending it to you, to see if you want to add it to slackbuild, so
everyone can use it. :)

       Again, thanks for your script.

higuita


-- 
May the Force be with you!

Yucatan "Kenjiro" Costa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20111209/e5154939/attachment.html>
-------------- next part --------------
#!/bin/sh

# Chromium launcher

# Authors:
#  Fabien Tassin <fta at sofaraway.org>
# License: GPLv2 or later
# minor changes for slackware support by higuita at gmx.net

if [ $HOSTTYPE == "x86_64" ] ; then 
	LIBDIRSUFFIX=64
else
	LIBDIRSUFFIX=
fi

#APPNAME=chromium
APPNAME=chrome
LIBDIR=/usr/lib$LIBDIRSUFFIX/chromium
EXTRALIB=
GDB=/usr/bin/gdb
BUILD_DIST="Slackware Slackbuild"

usage () {
  echo "$APPNAME [-h|--help] [-g|--debug] [--temp-profile] [options] [URL]"
  echo
  echo "        -g or --debug           Start within $GDB"
  echo "        -h or --help            This help screen"
  echo "        --temp-profile          Start with a new and temporary profile"
  echo
  echo " Other supported options are:"
  MANWIDTH=80 man chromium | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
  echo " See 'man chromium' for more details"
}

if [ -f /etc/$APPNAME/default ] ; then
  . /etc/$APPNAME/default
fi

# Prefer user defined CHROMIUM_USER_FLAGS (fron env) over system
# default CHROMIUM_FLAGS (from /etc/$APPNAME/default)
CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"}

# FFmpeg needs to know where its libs are located
if [ "Z$LD_LIBRARY_PATH" != Z ] ; then
  LD_LIBRARY_PATH=$LIBDIR:$EXTRALIB:$LD_LIBRARY_PATH
else
  LD_LIBRARY_PATH=$LIBDIR:$EXTRALIB
fi
export LD_LIBRARY_PATH

# For the Default Browser detection to work, we need to give access
# to xdg-settings. Also set CHROME_WRAPPER in case xdg-settings is
# not able to do anything useful
export PATH="$LIBDIR:$PATH"
export CHROME_WRAPPER="`readlink -f "$0"`"
export CHROME_DESKTOP=$APPNAME.desktop

#DIST=`lsb_release -si`
#RELEASE=`lsb_release -sr`
DIST=Slackware$LIBDIRSUFFIX
RELEASE=`cat /etc/slackware-version`

# Set CHROME_VERSION_EXTRA visible in the About dialog and in about:version
if [ "$DIST $RELEASE" = "$BUILD_DIST" ] ; then
  export CHROME_VERSION_EXTRA="$DIST $RELEASE"
else
  export CHROME_VERSION_EXTRA="Built on $BUILD_DIST, running on $DIST $RELEASE"
fi

want_debug=0
want_temp_profile=0
while [ $# -gt 0 ]; do
  case "$1" in
    -h | --help | -help )
      usage
      exit 0 ;;
    -g | --debug )
      want_debug=1
      shift ;;
    --temp-profile )
      want_temp_profile=1
      shift ;;
    -- ) # Stop option prcessing
      shift
      break ;;
    * )
      break ;;
  esac
done

if [ $want_temp_profile -eq 1 ] ; then
  TEMP_PROFILE=`mktemp -d`
  CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
fi

if [ $want_debug -eq 1 ] ; then
  if [ ! -x $GDB ] ; then
    echo "Sorry, can't find usable $GDB. Please install it."
    exit 1
  fi
  tmpfile=`mktemp /tmp/chromiumargs.XXXXXX` || { echo "Cannot create temporary file" >&2; exit 1; }
  trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
  echo "set args $CHROMIUM_FLAGS ${1+"$@"}" > $tmpfile
  echo "# Env:"
  echo "#     LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
  echo "#                PATH=$PATH"
  echo "#            GTK_PATH=$GTK_PATH"
  echo "# CHROMIUM_USER_FLAGS=$CHROMIUM_USER_FLAGS"
  echo "#      CHROMIUM_FLAGS=$CHROMIUM_FLAGS"
  echo "$GDB $LIBDIR/$APPNAME -x $tmpfile"
  $GDB "$LIBDIR/$APPNAME" -x $tmpfile
  if [ $want_temp_profile -eq 1 ] ; then
    rm -rf $TEMP_PROFILE
  fi
  exit $?
else
  if [ $want_temp_profile -eq 0 ] ; then
    exec $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
  else
    # we can't exec here as we need to clean-up the temporary profile
    $LIBDIR/$APPNAME $CHROMIUM_FLAGS "$@"
    rm -rf $TEMP_PROFILE
  fi
fi



More information about the SlackBuilds-users mailing list