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 381671395E2 for ; Sun, 27 Nov 2016 23:53:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1F745E0A84; Sun, 27 Nov 2016 23:53:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 E7D86E0A84 for ; Sun, 27 Nov 2016 23:53:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ACAE534114A for ; Sun, 27 Nov 2016 23:53:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4A9CF49C for ; Sun, 27 Nov 2016 23:53:11 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1480290767.1a3287d53e9912ab1033b64fcafdc1c341fd21ef.vapier@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-block/tgt/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-block/tgt/files/tgtd sys-block/tgt/files/tgtd-1.0.24.confd sys-block/tgt/files/tgtd-1.0.24.initd sys-block/tgt/files/tgtd.initd X-VCS-Directories: sys-block/tgt/files/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 1a3287d53e9912ab1033b64fcafdc1c341fd21ef X-VCS-Branch: master Date: Sun, 27 Nov 2016 23:53:11 +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: 3e5fc702-627b-4e99-b006-309d12252a6a X-Archives-Hash: e0b16afe289fd8ddf02c8f0b9670535e commit: 1a3287d53e9912ab1033b64fcafdc1c341fd21ef Author: Mike Frysinger gentoo org> AuthorDate: Sun Nov 27 23:52:47 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sun Nov 27 23:52:47 2016 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a3287d5 sys-block/tgt: fix bashisms in init.d script Also drop old unused init.d scripts. sys-block/tgt/files/tgtd | 125 --------------------------------- sys-block/tgt/files/tgtd-1.0.24.confd | 4 -- sys-block/tgt/files/tgtd-1.0.24.initd | 126 ---------------------------------- sys-block/tgt/files/tgtd.initd | 12 ++-- 4 files changed, 6 insertions(+), 261 deletions(-) diff --git a/sys-block/tgt/files/tgtd b/sys-block/tgt/files/tgtd deleted file mode 100644 index 0d9d0709..00000000 --- a/sys-block/tgt/files/tgtd +++ /dev/null @@ -1,125 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -TGTD_CONFIG=/etc/tgt/targets.conf - -TASK=$1 - -depend() { - need net -} - -start() { - ebegin "Starting target framework daemon" - ebegin "Starting ${SVCNAME}" - # Start tgtd first. - start-stop-daemon --start --quiet \ - --name tgtd \ - --exec /usr/sbin/tgtd - RETVAL=$? - if [ "$RETVAL" -ne 0 ] ; then - echo "Could not start tgtd (is tgtd already running?)" - exit 1 - fi - # We need to wait for 1 second before do anything with tgtd - sleep 1 - # Put tgtd into "offline" state until all the targets are configured. - # We don't want initiators to (re)connect and fail the connection - # if it's not ready - tgtadm --op update --mode sys --name State -v offline - # Configure the targets. - tgt-admin --update ALL -c $TGTD_CONFIG - # Put tgtd into "ready" state. - tgtadm --op update --mode sys --name State -v ready - eend $? -} - -stop() { - ebegin "Stopping ${SVCNAME}" - ebegin "Stopping target framework daemon" - # start-stop-daemon --stop --exec /usr/sbin/tgtd --quiet - if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then - forcedstop - fi - # Remove all targets. It only removes targets which are not in use. - tgt-admin --update ALL -c /dev/null &>/dev/null - # tgtd will exit if all targets were removed - tgtadm --op delete --mode system &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - if [ "$TASK" != "restart" ] ; then - exit 1 - fi - elif [ "$RETVAL" -ne 0 ] ; then - echo "Some initiators are still connected - could not stop tgtd" - exit 2 - fi - # echo -n - eend $? -} - -forcedstop() { - # NOTE: Forced shutdown of the iscsi target may cause data corruption - # for initiators that are connected. - echo "Force-stopping target framework daemon" - # Offline everything first. May be needed if we're rebooting, but - # expect the initiators to reconnect cleanly when we boot again - # (i.e. we don't want them to reconnect to a tgtd which is still - # working, but the target is gone). - tgtadm --op update --mode sys --name State -v offline &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - if [ "$TASK" != "restart" ] ; then - exit 1 - fi - else - tgt-admin --offline ALL - # Remove all targets, even if they are still in use. - tgt-admin --update ALL -c /dev/null -f - # It will shut down tgtd only after all targets were removed. - tgtadm --op delete --mode system - RETVAL=$? - if [ "$RETVAL" -ne 0 ] ; then - echo "Failed to shutdown tgtd" - exit 1 - fi - fi - echo -n -} - -reload() { - echo "Updating target framework daemon configuration" - # Update configuration for targets. Only targets which - # are not in use will be updated. - tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - exit 1 - fi -} - -forcedreload() { - echo "Force-updating target framework daemon configuration" - # Update configuration for targets, even those in use. - tgt-admin --update ALL -f -c $TGTD_CONFIG &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - exit 1 - fi -} - -status() { - # Don't name this script "tgtd"... - TGTD_PROC=$(ps -C tgtd | grep -c tgtd) - if [ "$TGTD_PROC" -eq 2 ] ; then - echo "tgtd is running. Run 'tgt-admin -s' to see detailed target info." - else - echo "tgtd is NOT running." - fi -} diff --git a/sys-block/tgt/files/tgtd-1.0.24.confd b/sys-block/tgt/files/tgtd-1.0.24.confd deleted file mode 100644 index fd4c098..00000000 --- a/sys-block/tgt/files/tgtd-1.0.24.confd +++ /dev/null @@ -1,4 +0,0 @@ -# Here you can specify options that are passed directly to tgt daemon -TGTD_OPTS="" - -# vim: ft=gentoo-conf-d diff --git a/sys-block/tgt/files/tgtd-1.0.24.initd b/sys-block/tgt/files/tgtd-1.0.24.initd deleted file mode 100644 index c824c09..00000000 --- a/sys-block/tgt/files/tgtd-1.0.24.initd +++ /dev/null @@ -1,126 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2012 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Id$ - -TGTD_CONFIG=/etc/tgt/targets.conf - -TASK=$1 - -depend() { - need net -} - -start() { - ebegin "Starting target framework daemon" - ebegin "Starting ${SVCNAME}" - # Start tgtd first. - start-stop-daemon --start --quiet \ - --name tgtd \ - --exec /usr/sbin/tgtd -- \ - ${TGTD_OPTS} - RETVAL=$? - if [ "$RETVAL" -ne 0 ] ; then - echo "Could not start tgtd (is tgtd already running?)" - exit 1 - fi - # We need to wait for 1 second before do anything with tgtd - sleep 1 - # Put tgtd into "offline" state until all the targets are configured. - # We don't want initiators to (re)connect and fail the connection - # if it's not ready - tgtadm --op update --mode sys --name State -v offline - # Configure the targets. - tgt-admin --update ALL -c $TGTD_CONFIG - # Put tgtd into "ready" state. - tgtadm --op update --mode sys --name State -v ready - eend $? -} - -stop() { - ebegin "Stopping ${SVCNAME}" - ebegin "Stopping target framework daemon" - # start-stop-daemon --stop --exec /usr/sbin/tgtd --quiet - if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then - forcedstop - fi - # Remove all targets. It only removes targets which are not in use. - tgt-admin --update ALL -c /dev/null &>/dev/null - # tgtd will exit if all targets were removed - tgtadm --op delete --mode system &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - if [ "$TASK" != "restart" ] ; then - exit 1 - fi - elif [ "$RETVAL" -ne 0 ] ; then - echo "Some initiators are still connected - could not stop tgtd" - exit 2 - fi - # echo -n - eend $? -} - -forcedstop() { - # NOTE: Forced shutdown of the iscsi target may cause data corruption - # for initiators that are connected. - echo "Force-stopping target framework daemon" - # Offline everything first. May be needed if we're rebooting, but - # expect the initiators to reconnect cleanly when we boot again - # (i.e. we don't want them to reconnect to a tgtd which is still - # working, but the target is gone). - tgtadm --op update --mode sys --name State -v offline &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - if [ "$TASK" != "restart" ] ; then - exit 1 - fi - else - tgt-admin --offline ALL - # Remove all targets, even if they are still in use. - tgt-admin --update ALL -c /dev/null -f - # It will shut down tgtd only after all targets were removed. - tgtadm --op delete --mode system - RETVAL=$? - if [ "$RETVAL" -ne 0 ] ; then - echo "Failed to shutdown tgtd" - exit 1 - fi - fi - echo -n -} - -reload() { - echo "Updating target framework daemon configuration" - # Update configuration for targets. Only targets which - # are not in use will be updated. - tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - exit 1 - fi -} - -forcedreload() { - echo "Force-updating target framework daemon configuration" - # Update configuration for targets, even those in use. - tgt-admin --update ALL -f -c $TGTD_CONFIG &>/dev/null - RETVAL=$? - if [ "$RETVAL" -eq 107 ] ; then - echo "tgtd is not running" - exit 1 - fi -} - -status() { - # Don't name this script "tgtd"... - TGTD_PROC=$(ps -C tgtd | grep -c tgtd) - if [ "$TGTD_PROC" -eq 2 ] ; then - echo "tgtd is running. Run 'tgt-admin -s' to see detailed target info." - else - echo "tgtd is NOT running." - fi -} diff --git a/sys-block/tgt/files/tgtd.initd b/sys-block/tgt/files/tgtd.initd index bf20870..a1934d4 100644 --- a/sys-block/tgt/files/tgtd.initd +++ b/sys-block/tgt/files/tgtd.initd @@ -41,13 +41,13 @@ stop() { ebegin "Stopping ${SVCNAME}" ebegin "Stopping target framework daemon" # start-stop-daemon --stop --exec /usr/sbin/tgtd --quiet - if [ "$RUNLEVEL" == 0 -o "$RUNLEVEL" == 6 ] ; then + if [ "$RUNLEVEL" = 0 -o "$RUNLEVEL" = 6 ] ; then forcedstop fi # Remove all targets. It only removes targets which are not in use. - tgt-admin --update ALL -c /dev/null &>/dev/null + tgt-admin --update ALL -c /dev/null >/dev/null 2>&1 # tgtd will exit if all targets were removed - tgtadm --op delete --mode system &>/dev/null + tgtadm --op delete --mode system >/dev/null 2>&1 RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then echo "tgtd is not running" @@ -70,7 +70,7 @@ forcedstop() { # expect the initiators to reconnect cleanly when we boot again # (i.e. we don't want them to reconnect to a tgtd which is still # working, but the target is gone). - tgtadm --op update --mode sys --name State -v offline &>/dev/null + tgtadm --op update --mode sys --name State -v offline >/dev/null 2>&1 RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then echo "tgtd is not running" @@ -96,7 +96,7 @@ reload() { echo "Updating target framework daemon configuration" # Update configuration for targets. Only targets which # are not in use will be updated. - tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null + tgt-admin --update ALL -c $TGTD_CONFIG >/dev/null 2>&1 RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then echo "tgtd is not running" @@ -107,7 +107,7 @@ reload() { forcedreload() { echo "Force-updating target framework daemon configuration" # Update configuration for targets, even those in use. - tgt-admin --update ALL -f -c $TGTD_CONFIG &>/dev/null + tgt-admin --update ALL -f -c $TGTD_CONFIG >/dev/null 2>&1 RETVAL=$? if [ "$RETVAL" -eq 107 ] ; then echo "tgtd is not running"