[packages/chromium-browser] launcher: inline commandline options help from manpage

glen glen at pld-linux.org
Tue Feb 12 12:51:52 CET 2013


commit 535cb410ebad59d892d3f4e6276efbf6968ed441
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Feb 12 13:50:51 2013 +0200

    launcher: inline commandline options help from manpage

 chromium-browser.sh   | 27 +++++++++++++++------------
 chromium-browser.spec | 14 +++++++++++++-
 2 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/chromium-browser.spec b/chromium-browser.spec
index 88d27fa..43d55c3 100644
--- a/chromium-browser.spec
+++ b/chromium-browser.spec
@@ -160,6 +160,7 @@ BuildRequires:	libstdc++-devel
 BuildRequires:	libxml2-devel
 BuildRequires:	libxslt-devel
 BuildRequires:	lzma
+BuildRequires:	man-db
 %{?with_system_minizip:BuildRequires:	minizip-devel}
 BuildRequires:	nspr-devel
 BuildRequires:	nss-devel >= 1:3.12.3
@@ -437,6 +438,10 @@ test -e Makefile || %{__python} build/gyp_chromium \
 	CFLAGS="%{rpmcflags} %{rpmcppflags}" \
 	CXXFLAGS="%{rpmcxxflags} %{rpmcppflags}"
 
+cd ../out/%{!?debug:Release}%{?debug:Debug}
+MANWIDTH=80 man ./chrome.1 > man.out
+%{__sed} -e '1,/OPTIONS/d; /ENVIRONMENT/,$d' man.out > options.txt
+
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_libdir}/%{name}/{themes,plugins,extensions} \
@@ -445,7 +450,14 @@ install -d $RPM_BUILD_ROOT%{_libdir}/%{name}/{themes,plugins,extensions} \
 cd out/%{!?debug:Release}%{?debug:Debug}
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/default
 install -p %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/%{name}
-%{__sed} -i -e 's, at libdir@,%{_libdir}/%{name},' $RPM_BUILD_ROOT%{_bindir}/%{name}
+%{__sed} -i -e '
+	s, at libdir@,%{_libdir}/%{name},
+
+	/@OPTIONS@/ {
+		r options.txt
+		d
+	}
+' $RPM_BUILD_ROOT%{_bindir}/%{name}
 cp -a *.pak locales resources $RPM_BUILD_ROOT%{_libdir}/%{name}
 cp -p chrome.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
 install -p chrome $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}
diff --git a/chromium-browser.sh b/chromium-browser.sh
index 8146f91..8aa1e38 100755
--- a/chromium-browser.sh
+++ b/chromium-browser.sh
@@ -6,7 +6,7 @@ GDB=/usr/bin/gdb
 # Allow the user to override command-line flags, http://bugs.gentoo.org/357629
 # This is based on Debian's chromium-browser package, and is intended
 # to be consistent with Debian.
-if [ -f /etc/$APPNAME/default ] ; then
+if [ -f /etc/$APPNAME/default ]; then
 	. /etc/$APPNAME/default
 fi
 
@@ -16,15 +16,18 @@ die() {
 }
 
 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 $APPNAME | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d'
-	echo "See 'man $APPNAME' for more details"
+	cat <<EOF
+$APPNAME [-h|--help] [-g|--debug] [--temp-profile] [options] [URL]
+
+		-g or --debug           Start within $GDB
+		-h or --help            This help screen
+		--temp-profile          Start with a new and temporary profile
+
+Other supported options are:
+
+ at OPTIONS@
+See 'man $APPNAME' for more details
+EOF
 }
 
 export LD_LIBRARY_PATH=$LIBDIR${LD_LIBRARY_PATH:+:"$LD_LIBRARY_PATH"}
@@ -46,7 +49,7 @@ fi
 
 # lsb_release is slow so try to source the static file /etc/lsb-release
 # instead, and fallback to lsb_release if we didn't get the information we need
-if [ -e /etc/lsb-release ] ; then
+if [ -e /etc/lsb-release ]; then
 	. /etc/lsb-release
 fi
 DIST=${DISTRIB_ID:-$(lsb_release -si)}
@@ -109,7 +112,7 @@ if [ $want_temp_profile -eq 1 ]; then
 fi
 
 if [ $want_debug -eq 1 ]; then
-	if [ ! -x $GDB ] ; then
+	if [ ! -x $GDB ]; then
 		die "Sorry, can't find usable $GDB. Please install it."
 	fi
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/chromium-browser.git/commitdiff/535cb410ebad59d892d3f4e6276efbf6968ed441



More information about the pld-cvs-commit mailing list