Signed-off-by: Gordian Edenhofer <[email protected]>
---
 contrib/bacman.sh.in | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
index a0bfcf1..ca2945f 100644
--- a/contrib/bacman.sh.in
+++ b/contrib/bacman.sh.in
@@ -41,25 +41,33 @@ clean_up() {
        echo
        exit
 }
-
 # Trap termination signals
 trap clean_up SIGHUP SIGINT SIGTERM
 
 # Print usage information
 usage() {
-       echo "${myname} (pacman) v${myver}"
-       echo
-       echo "Recreate a package using pacman's database and system files"
-       echo
-       echo "Usage: ${myname} [--nocolor] [--pacnew] <installed package name>"
-       echo
-       echo "Example: ${myname} linux-headers"
+       cat <<-EOF
+       $myname (pacman) v$myver
+       This script was design to reassemble installed packages from its 
deliverd files.
+       It comes in handy if you have no access to an up-to-date package cache.
+
+       Usage: $myname [options] <package(s)>
+           -h, --help              display this help message and exit
+           --nocolor               turn off color in output
+           --pacnew                package .pacnew files
+
+       Examples:   # $myname linux-headers
+                   # $myname gzip munge binutils -o ~/Downloads
+                   # $myname --nocolor --pacnew gzip munge binutils
+                   # $myname \$(pacman -Qsq)
+       EOF
 }
 
 # Print version information
 version() {
        printf "%s %s\n" "$myname" "$myver"
        echo 'Copyright (C) 2008 locci <carlocci_at_gmail_dot_com>'
+       echo 'Copyright (C) 2016 Gordian Edenhofer 
<[email protected]>'
        echo 'Copyright (C) 2008-2016 Pacman Development Team 
<[email protected]>'
 }
 
@@ -123,7 +131,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 +147,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 +347,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 +361,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"
@@ -362,7 +371,6 @@ fakebuild() {
 
        # Clean up working directory
        rm -rf "$work_dir"
-       msg "Done."
 }
 
 # Run fakebuild in parralel with at maximum $MAX_JOBS jobs
@@ -391,6 +399,7 @@ else
        done
 fi
 
+msg "Done."
 exit 0
 
 # vim: set noet:
-- 
2.9.3

Reply via email to