diff options
author | Dubiousjim <dubiousjim@gmail.com> | 2013-07-05 00:21:19 -0400 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-07-09 06:59:30 +0000 |
commit | ef9fb52908d3f423e6e537b84f62cb76c7868782 (patch) | |
tree | ae6e61c807f98893d84f189468444d5aa04ba3c7 /abump.in | |
parent | 7b2030a06ad926035fabbad64aac4ddeab0bb602 (diff) | |
download | abuild-ef9fb52908d3f423e6e537b84f62cb76c7868782.tar.gz abuild-ef9fb52908d3f423e6e537b84f62cb76c7868782.tar.bz2 abuild-ef9fb52908d3f423e6e537b84f62cb76c7868782.tar.xz abuild-ef9fb52908d3f423e6e537b84f62cb76c7868782.zip |
various: use long options, rework usages
Diffstat (limited to 'abump.in')
-rwxr-xr-x | abump.in | 53 |
1 files changed, 36 insertions, 17 deletions
@@ -56,29 +56,48 @@ fixes #${fixes#\#} } usage() { - echo "$prog - utility to bump pkgver in APKBUILDs" - echo "usage: $prog [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]" - echo "" - echo " -h show this help" - echo " -R run abuild with -R for recursive building" - echo " -k keep existing packages" - echo " -s security update" - echo " -f fixes ISSUE" - exit 0 + cat >&2 <<__EOF__ +$prog $abuild_ver - bump pkgver in APKBUILDs +Usage: $prog [-s CVE-1,CVE-2,...] [-f ISSUE] [-R|--recursive] [-k|--keep] PKGNAME-1.2.3 ... +Options: + -s, --security CVE1,CVE-2,... Security update + -f, --fixes ISSUE Fixes ISSUE + -R, --recursive Run abuild with -R for recursive building + -k, --keep Run abuild with -k to keep existing packages + -q, --quiet + -h, --help Show this help + +__EOF__ } keep= recursive="-r" -while getopts "f:hkRs:" opt; do - case $opt in - f) fixes="${OPTARG}";; - h) usage;; - k) keep="-k";; - R) recursive="-R";; - s) cvelist="$OPTARG";; +cvelist= +fixes= + +args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"` +if [ $? -ne 0 ]; then + usage + exit 2 +fi +eval set -- "$args" +while true; do + case $1 in + -s|--security) cvelist="$2"; shift;; + -f|--fixes) fixes="$2"; shift;; + -R|--recursive) recursive="-R";; + -k|--keep) keep="-k";; + -q|--quiet) quiet=1;; # suppresses msg + -h|--help) usage; exit;; + --) shift; break;; + *) exit 1;; # getopt error esac + shift done -shift $(( $OPTIND - 1)) +if [ $# -eq 0 ]; then + usage + exit 2 +fi abuild_opts="$recursive $keep" |