From 56bd759df1d0c750a065b8c845e93d5dfa6b549d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 8 Aug 2015 13:49:04 -0700 Subject: proj/gentoo: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson X-Thanks: Alec Warner - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring - wrote much python to improve cvs2svn X-Thanks: Rich Freeman - validation scripts X-Thanks: Patrick Lauer - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed --- sys-block/lio-utils/files/target.initd | 137 +++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 sys-block/lio-utils/files/target.initd (limited to 'sys-block/lio-utils/files/target.initd') diff --git a/sys-block/lio-utils/files/target.initd b/sys-block/lio-utils/files/target.initd new file mode 100644 index 000000000000..56bec1efe326 --- /dev/null +++ b/sys-block/lio-utils/files/target.initd @@ -0,0 +1,137 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="Linux-iSCSI.org target" + +depend() { + after modules + use net +} + +MODNAME="target_core_mod" + +TCM_CFS_DIR="/sys/kernel/config/target/core" +LIO_CFS_DIR="/sys/kernel/config/target/iscsi" +TCM_NODE="/usr/sbin/tcm_node" +LIO_NODE="/usr/sbin/lio_node" +TCM_FABRIC="/usr/sbin/tcm_fabric" +CONFIGFS_SCRIPT_DIR="/etc/target" +TCM_CONFIGFS_SCRIPT="/etc/target/tcm_start.sh" +LIO_CONFIGFS_SCRIPT="/etc/target/lio_start.sh" +TCM_CORE_MODULE="target_core_mod" +TCM_CORE_IO_MODULES="target_core_iblock target_core_file target_core_pscsi" +FABRICS_MODULES="tcm_fc tcm_loop ib_srpt" +LIO_MODULE="iscsi_target_mod" + +checkconfig() { + if ! modinfo ${TCM_CORE_MODULE} > /dev/null 2>&1 ; then + eerror "Target Core modules not found!" + return 1 + elif ! modinfo ${LIO_MODULE} > /dev/null 2>&1 ; then + eerror "Linux iSCSI modules not found!" + return 1 + elif [ ! -f ${TCM_CONFIGFS_SCRIPT} ]; then + eerror "${TCM_CONFIGFS_SCRIPT} does not exist. run targetcli to configure your target!" + return 1 + elif [ ! -f ${LIO_CONFIGFS_SCRIPT} ]; then + eerror "${LIO_CONFIGFS_SCRIPT} does not exist. run targetcli to configure your target!" + return 1 + fi +} + +fabrics_start() { + ebegin "Starting Targets: " + for module in ${FABRICS_MODULES}; do + if modinfo $module > /dev/null 2>&1 ; then + ebegin "Loading ${module}" + modprobe ${module} + eend $? + fi + done + for cfgscript in ${CONFIGFS_SCRIPT_DIR}/*.sh; do + if [ ! -f ${cfgscript} ]; then + continue + fi + # target core is handled in tcm_start + if [ ${cfgscript} == ${TCM_CONFIGFS_SCRIPT} ]; then + continue + fi + # iscsi-target fabric module is handled in lio_target_start + if [ ${cfgscript} == ${LIO_CONFIGFS_SCRIPT} ]; then + continue + fi + ebegin "Calling ConfigFS script $cfgscript: " + sh ${cfgscript} > /dev/null 2>&1 + eend $? + done + eend $? +} + +lio_target_start() { + ebegin "Loading iSCSI target modules: ${LIO_MODULE}" + modprobe ${LIO_MODULE} + eend $? + ebegin "Configuring iSCSI target iscsi_target_mod" + sh ${LIO_CONFIGFS_SCRIPT} > /dev/null 2>&1 + eend $? +} + +tcm_start() { + ebegin "Loading Target Core modules : ${TCM_CORE_MODULE}" + modprobe ${TCM_CORE_MODULE} + eend $? + ebegin "Loading Target Core backend modules: " + for module in ${TCM_CORE_IO_MODULES} ; do + ebegin "${module}" + modprobe ${module} + eend $? + done + eend $? + ebegin "Calling ConfigFS script $TCM_CONFIGFS_SCRIPT for target_core_mod" + sh ${TCM_CONFIGFS_SCRIPT} > /dev/null 2>&1 + eend $? +} + +lio_target_stop() { + ebegin "Unload Linux-iSCSI.org Fabric module" + ${LIO_NODE} --unload + eend $? +} + +fabrics_stop() { + ebegin "Unloading misc fabric modules: " + ${TCM_FABRIC} --unloadall + eend $? +} + +tcm_stop() { + ebegin "Unloading Target Core modules: " + $TCM_NODE --unload + eend $? +} + +start() { + checkconfig + tcm_start + lio_target_start + fabrics_start +} + +stop() { + lio_target_stop + fabrics_stop + tcm_stop +} + +status() { + if [[ -d ${TCM_CFS_DIR} && -d ${LIO_CFS_DIR} ]]; then + einfo "Target core mode status" + ${TCM_NODE} --listhbas + einfo "Linux iSCSI status" + ${LIO_NODE} --listendpoints + else + einfo "Target not started (yet)" + fi +} -- cgit v1.2.3-65-gdbad