From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 1B99D139694 for ; Mon, 12 Jun 2017 23:29:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D4043E0E62; Mon, 12 Jun 2017 23:29:00 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0B6BE0E62 for ; Mon, 12 Jun 2017 23:29:00 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 573033419E6 for ; Mon, 12 Jun 2017 23:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 620DA7483 for ; Mon, 12 Jun 2017 23:28:56 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1497308894.fe5567bb04b3bacfb473d707e3eb936571c06661.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:0.27.x commit in: scripts/ X-VCS-Repository: proj/openrc X-VCS-Files: scripts/shutdown.in X-VCS-Directories: scripts/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: fe5567bb04b3bacfb473d707e3eb936571c06661 X-VCS-Branch: 0.27.x Date: Mon, 12 Jun 2017 23:28:56 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c921d6b4-8401-467f-83af-57cc92089fcf X-Archives-Hash: 44b710938de115d9c94ada29884040ed commit: fe5567bb04b3bacfb473d707e3eb936571c06661 Author: William Hubbs gmail com> AuthorDate: Mon Jun 12 22:58:18 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon Jun 12 23:08:14 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=fe5567bb fix argument parsing for the sysvinit shutdown wrapper This fixes #140. scripts/shutdown.in | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/shutdown.in b/scripts/shutdown.in index 4a3d9fd1..69a4a12a 100644 --- a/scripts/shutdown.in +++ b/scripts/shutdown.in @@ -1,17 +1,21 @@ #!@SHELL@ -args= -for x; do - case "$x" in - -h) args=" ${args} --halt" ;; - *) args=" ${args} ${x} " ;; +poweroff_arg= +while getopts :HhPr opt; do + case "$opt" in + h|P) poweroff_arg=--poweroff ;; + H) poweroff_arg=--halt ;; + r) poweroff_arg=--reboot ;; + \?) printf "${0##*/}: invalid option ${optarg}\n" >&2 + exit 1 + ;; esac done +shift $((OPTIND-1)) -case "$args" in - *-h|--halt*) ;; - *-s|--single*) ;; - *) args=" --single ${args}" ;; -esac +if [ -z "${poweroff_arg}" ]; then + poweroff_arg=--single +fi -exec @SBINDIR@/openrc-shutdown "$args" +echo @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@} +exec @SBINDIR@/openrc-shutdown ${poweroff_arg} ${@}