Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com> --- contrib/bacman.sh.in | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in index ca2945f..322bb66 100644 --- a/contrib/bacman.sh.in +++ b/contrib/bacman.sh.in @@ -28,6 +28,7 @@ declare -r myname='bacman' declare -r myver='@PACKAGE_VERSION@' USE_COLOR='y' INCLUDE_PACNEW='n' +QUIET='n' # Required for fakeroot because options are shifted off the array. ARGS=("$@") @@ -53,6 +54,7 @@ usage() { Usage: $myname [options] <package(s)> -h, --help display this help message and exit + -q, --quiet silence most of the status reporting --nocolor turn off color in output --pacnew package .pacnew files @@ -86,8 +88,8 @@ for option in "$@"; do done # Parse arguments -OPT_SHORT=':v' -OPT_LONG=('nocolor' 'pacnew' 'version') +OPT_SHORT=':qv' +OPT_LONG=('quiet' 'nocolor' 'pacnew' 'version') if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then usage exit 1 @@ -97,6 +99,8 @@ unset OPT_SHORT OPT_LONG OPTRET while :; do case "$1" in + -q|--quiet) + QUIET='y' ;; --nocolor) USE_COLOR='n' ;; --pacnew) @@ -180,7 +184,10 @@ fakebuild() { cd "$work_dir" || exit 1 # Assemble list of files which belong to the package and tar them - msg2 "Copying package files..." + if [[ "$QUIET" != "y" ]]; then + msg2 "Copying package files..." + fi + while read i; do if [[ -z $i ]]; then continue @@ -254,7 +261,9 @@ fakebuild() { # Reconstruct .PKGINFO from database # TODO adopt makepkg's write_pkginfo() into this or scripts/library - msg2 "Generating .PKGINFO metadata..." + if [[ "$QUIET" != "y" ]]; then + msg2 "Generating .PKGINFO metadata..." + fi echo "# Generated by $myname $myver" > .PKGINFO if [[ $INFAKEROOT == "1" ]]; then echo "# Using $(fakeroot -v)" >> .PKGINFO @@ -342,7 +351,9 @@ fakebuild() { chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null # Generate the package - msg2 "Generating the package..." + if [[ "$QUIET" != "y" ]]; then + msg2 "Generating the package..." + fi pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}" ret=0 -- 2.9.3