[pacman-dev] [PATCH] Added -m/--nocolor options to updpkgsums
Fixes FS#43346 Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk> --- contrib/updpkgsums.sh.in | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/contrib/updpkgsums.sh.in b/contrib/updpkgsums.sh.in index aaed700..c571d29 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) { -- 2.8.0
On 02/05/16 03:03, Ashley Whetter wrote:
Fixes FS#43346
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk> ---
OK.
participants (2)
-
Allan McRae
-
Ashley Whetter