diff options
author | Ashley Whetter <ashley@awhetter.co.uk> | 2016-05-01 18:03:08 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-05-05 13:52:23 +1000 |
commit | b012da645e14e5f79968d6670dcc5e51232c4adb (patch) | |
tree | 66490cb02a1ca8d2d35aec3f3794d68dce836864 /contrib | |
parent | 6c96ad36e082755e8a008b34aedde55a9a9f3dcd (diff) | |
download | pacman-b012da645e14e5f79968d6670dcc5e51232c4adb.tar.xz |
Add -m/--nocolor options to updpkgsums
Fixes FS#43346
Signed-off-by: Ashley Whetter <ashley@awhetter.co.uk>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/updpkgsums.sh.in | 23 |
1 files changed, 16 insertions, 7 deletions
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) { |