From b012da645e14e5f79968d6670dcc5e51232c4adb Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Sun, 1 May 2016 18:03:08 +0100 Subject: Add -m/--nocolor options to updpkgsums Fixes FS#43346 Signed-off-by: Ashley Whetter Signed-off-by: Allan McRae --- contrib/updpkgsums.sh.in | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'contrib/updpkgsums.sh.in') diff --git a/contrib/updpkgsums.sh.in b/contrib/updpkgsums.sh.in index aaed700a..c571d297 100644 --- a/contrib/updpkgsums.sh.in +++ b/contrib/updpkgsums.sh.in @@ -29,10 +29,13 @@ usage() { echo "path specified by [build file], defaulting to PKGBUILD in the current" echo "working directory." echo - printf "Usage: %s [build file]\n" "${myname}" + printf "Usage: %s [options] [build file]\n" "${myname}" echo echo " -h, --help display this help message and exit" echo " -V, --version display version information and exit" + echo + echo "These options can be passed to makepkg:" + echo " -m, --nocolor disable colorized output messages" } version() { @@ -45,12 +48,18 @@ die() { exit 1 } -case $1 in - -h|--help) usage; exit ;; - -V|--version) version; exit ;; -esac +MAKEPKG_OPTS=() +buildfile='PKGBUILD' + +while (( "$#" )); do + case "$1" in + -h|--help) usage; exit ;; + -m|--nocolor) MAKEPKG_OPTS+=("$1"); shift ;; + -V|--version) version; exit ;; + *) buildfile="$1"; break 2 ;; + esac +done -buildfile=${1:-PKGBUILD} if [[ ! -f $buildfile ]]; then die "%s not found or is not a file" "$buildfile" fi @@ -83,7 +92,7 @@ export BUILDDIR=$(mktemp -d "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT -newsums=$(makepkg -g -p "$buildfile") || die 'Failed to generate new checksums' +newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums' awk -v newsums="$newsums" ' /^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ { if (!w) { -- cgit v1.2.3-70-g09d2