X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@mail.alpinelinux.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 887C1DC0CE6 for ; Mon, 1 Jul 2013 21:14:19 +0000 (UTC) Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 35F9220C89 for ; Mon, 1 Jul 2013 17:14:19 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute2.internal (MEProxy); Mon, 01 Jul 2013 17:14:19 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :in-reply-to:references; s=smtpout; bh=jezXTZPH+EeUbweVLJfMowr4V LA=; b=GJVXDaWycYbZBpCIfcJrmx4fHa1kf7VLkbT3c8HKzVUp23I4scuqRWh4y T1JoJ5Gvq3gkH3vDlAjHLCWc9TZWPns2Ws4wfqV6QMtJT78p9TW4fJ9o1UdKZq4S BS8bAWY8h0XvMXL+dweVFXfLW9TkStKet9bmqNLbPrqVXzgp40= X-Sasl-enc: PjoHRLJghuFFzDKEqFSC5fpkPx6RegNB+F2bW0zb+P8L 1372713259 Received: from localhost (unknown [69.86.161.244]) by mail.messagingengine.com (Postfix) with ESMTPA id 0837A680268 for ; Mon, 1 Jul 2013 17:14:18 -0400 (EDT) From: Dubiousjim To: alpine-devel@lists.alpinelinux.org Subject: [alpine-devel] [PATCH 3/4] update-conf: accept long options Date: Mon, 1 Jul 2013 17:14:16 -0400 Message-Id: <6d0295ddc265976445cb2d46c6194db304e92386.1372713126.git.dubiousjim@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: --- update-conf.in | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/update-conf.in b/update-conf.in index 6a8ab16..da4208c 100644 --- a/update-conf.in +++ b/update-conf.in @@ -10,14 +10,16 @@ init_tmpdir TMPD LBUCACHE="$TMPD/lbucache" usage() { - echo "$PROGRAM $VERSION -Usage: $PROGAM [-aihl] + cat >&2 << __EOF__ +$PROGRAM $VERSION - TODO what is it? +Usage: $PROGRAM [-a|--all] [-i|--initd] [-l|--list] [-h|--help] +Options: + -a, --all Select all updated files + -i, --initd Use all new init.d scripts + -l, --list List updated files + -h, --help Show this help - -a Select all updated files. - -h Show this help. - -i Use all new init.d scripts. - -l List updated files. -" +__EOF__ } @@ -31,15 +33,23 @@ is_initd() { echo "$1" | grep etc/init.d/ > /dev/null } -while getopts "alih" opt ; do - case "$opt" in - a) aflag="-a" ;; - i) iflag="-i" ;; - l) lflag="-l" ;; - h|*) usage;; - esac +args=`getopt -o ailh --long all,initd,list,help -n "$PROGRAM" -- "$@"` +if [ $? -ne 0 ]; then + usage + exit 2 +fi +eval set -- "$args" +while true; do + case $1 in + -a|--all) aflag="-a";; + -i|--initd) iflag="-i";; + -l|--list) lflag="-l";; + -h|--help) usage; exit;; + --) shift; break;; + *) exit 1;; # getopt error + esac + shift done -shift `expr $OPTIND - 1` for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do p="${apknew%.apk-new}" -- 1.8.3.1 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---