[pacman-dev] [PATCH v6 4/9] bacman: rewrite usage page and version information

Gordian Edenhofer gordian.edenhofer at gmail.com
Fri Sep 2 14:50:09 UTC 2016


Signed-off-by: Gordian Edenhofer <gordian.edenhofer at gmail.com>
---
 contrib/bacman.sh.in | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
index 8656c5c..f5807b5 100644
--- a/contrib/bacman.sh.in
+++ b/contrib/bacman.sh.in
@@ -41,19 +41,26 @@ clean_up() {
 	echo
 	exit
 }
-
 # Trap termination signals
 trap clean_up SIGHUP SIGINT SIGTERM
 
 # Print usage information
 usage() {
-	echo "${myname} (pacman) v${myver}"
+	printf "%s (pacman) %s\n" "$myname" "$myver"
+	echo
+	printf -- "$(gettext "Recreate packages using pacman's database and system files")\n"
+	echo
+	printf -- "$(gettext "Usage: %s [options] <package(s)>")\n" "$0"
 	echo
-	echo "Recreate a package using pacman's database and system files"
+	printf -- "$(gettext "Options:")\n"
+	printf -- "$(gettext "  -h, --help       Show this help message and exit")\n"
+	printf -- "$(gettext "  -m, --nocolor    Disable colorized output messages")\n"
+	printf -- "$(gettext "  --pacnew         Package .pacnew files")\n"
 	echo
-	echo "Usage: ${myname} [--nocolor] [--pacnew] <installed package name>"
+	printf -- "$(gettext "Examples:  %s linux-headers")\n" "$myname"
+	printf -- "$(gettext "  %s --nocolor --pacnew gzip munge binutils")\n" "$myname"
+	printf -- "$(gettext "  %s \$(pacman -Qsq)")\n" "$myname"
 	echo
-	echo "Example: ${myname} linux-headers"
 }
 
 # Print version information
@@ -123,7 +130,7 @@ if (( EUID )); then
 	fi
 fi
 
-# Source environmental variables and specify fallbacks
+# Read in environmental variables
 if [[ ! -r @sysconfdir@/pacman.conf ]]; then
 	error "unable to read @sysconfdir@/pacman.conf"
 	exit 1
@@ -139,7 +146,7 @@ if [[ -r ~/.makepkg.conf ]]; then
 	source ~/.makepkg.conf
 fi
 pkg_dest="${PKGDEST:-$PWD}"
-pkg_pkger=${PACKAGER:-'Unknown Packager'}
+pkg_pkger="${PACKAGER:-'Unknown Packager'}"
 
 # Check for an existing database
 if [[ ! -d $pac_db ]]; then
@@ -339,6 +346,7 @@ fakebuild() {
 	pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
 	ret=0
 
+	# Move compressed package to destination
 	# TODO: Maybe this can be set globally for robustness
 	shopt -s -o pipefail
 	bsdtar -cf - $comp_files * |
@@ -352,7 +360,7 @@ fakebuild() {
 		"$PKGEXT"; cat ;;
 	esac > "${pkg_file}"; ret=$?
 
-	# Move compressed package to destination
+	# Evaluate return code
 	if (( ret )); then
 		error "Unable to write package to $pkg_dest"
 		plain "       Maybe the disk is full or you do not have write access"
-- 
2.9.3


More information about the pacman-dev mailing list