+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) || exit 1
+ CHROMIUM_FLAGS="$CHROMIUM_FLAGS --user-data-dir=$TEMP_PROFILE"
+fi
+
+if [ $want_debug -eq 1 ]; then
+ if [ ! -x $GDB ] ; then
+ die "Sorry, can't find usable $GDB. Please install it."
+ fi
+
+ tmpfile=$(mktemp /tmp/chromiumargs.XXXXXX) || die "Cannot create temporary file"
+ 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
+ rc=$?
+ if [ $want_temp_profile -eq 1 ]; then
+ rm -rf $TEMP_PROFILE
+ fi
+ exit $rc
+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