summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2005-09-20 08:00:38 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2005-09-20 08:00:38 +0000
commit8fb0257ba80538992ea7c961f29d45004877e9e5 (patch)
treea9e924c1e350b0c01fb3685013585e6a32a4e1b3 /sys-block/open-iscsi
parentInitial import. Ebuild made by Tomasz Mrugalski <thomson@klub.com.pl>. (diff)
downloadgentoo-2-8fb0257ba80538992ea7c961f29d45004877e9e5.tar.gz
gentoo-2-8fb0257ba80538992ea7c961f29d45004877e9e5.tar.bz2
gentoo-2-8fb0257ba80538992ea7c961f29d45004877e9e5.zip
Change SRC_URI to mirror://gentoo/ now that the source has spread, also clean up install location for modules, security of config file and databases, and clean up the init script to be gentoo-like instead of debian-like.
(Portage version: 2.0.51.22-r2)
Diffstat (limited to 'sys-block/open-iscsi')
-rw-r--r--sys-block/open-iscsi/ChangeLog9
-rw-r--r--sys-block/open-iscsi/files/iscsid-init.d77
-rw-r--r--sys-block/open-iscsi/open-iscsi-0.4.413.ebuild17
3 files changed, 58 insertions, 45 deletions
diff --git a/sys-block/open-iscsi/ChangeLog b/sys-block/open-iscsi/ChangeLog
index c11da8000356..77f56b1d0a08 100644
--- a/sys-block/open-iscsi/ChangeLog
+++ b/sys-block/open-iscsi/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-block/open-iscsi
# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.1 2005/09/20 04:33:34 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/ChangeLog,v 1.2 2005/09/20 08:00:38 robbat2 Exp $
+
+ 20 Sep 2005; Robin H. Johnson <robbat2@gentoo.org> files/iscsid-init.d,
+ open-iscsi-0.4.413.ebuild:
+ Change SRC_URI to mirror://gentoo/ now that the source has spread, also
+ clean up install location for modules, security of config file and
+ databases, and clean up the init script to be gentoo-like instead of
+ debian-like.
*open-iscsi-0.4.413 (20 Sep 2005)
diff --git a/sys-block/open-iscsi/files/iscsid-init.d b/sys-block/open-iscsi/files/iscsid-init.d
index 060a311d3106..f08b64542189 100644
--- a/sys-block/open-iscsi/files/iscsid-init.d
+++ b/sys-block/open-iscsi/files/iscsid-init.d
@@ -1,10 +1,13 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-init.d,v 1.1 2005/09/20 04:33:34 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/files/iscsid-init.d,v 1.2 2005/09/20 08:00:38 robbat2 Exp $
PID_FILE=/var/run/iscsid.pid
CONFIG_FILE=/etc/iscsid.conf
+DUMP_DIR=/var/db/iscsi
+DUMP_NODE="${DUMP_DIR}/node.dump"
+DUMP_DISCOVERY="${DUMP_DIR}/discovery.dump"
INITIATORNAME=/etc/initiatorname.iscsi
DAEMON=/usr/sbin/iscsid
@@ -23,58 +26,50 @@ checkconfig() {
start() {
checkconfig
- echo -n "Starting iSCSI initiator service: "
+ ebegin "Starting iSCSI initiator service"
modprobe scsi_transport_iscsi
modprobe iscsi_tcp
start-stop-daemon --start --exec $DAEMON --quiet
- RETVAL=$?
- if [ $RETVAL == "0" ]; then
- echo "succeeded."
- else
- echo "failed."
- fi
-
- echo -n "Removing iSCSI modules: "
- modprobe -r iscsi_tcp
- modprobe -r scsi_transport_iscsi
- RETVAL=$?
- if [ $RETVAL == "0" ]; then
- echo "succeeded."
- else
- echo "failed."
- return 1
- fi
+ ret=$?
+ eend $ret
+ [ $ret -gt 0 ] && return $ret
}
stop() {
- echo -n "Stopping iSCSI initiator service: "
+ ebegin "Stopping iSCSI initiator service"
start-stop-daemon --stop --quiet --exec $DAEMON --pidfile $PID_FILE
- RETVAL=$?
- if [ $RETVAL == "0" ]; then
- echo "succeeded."
- else
- echo "failed."
- fi
+ eend $?
+
# ugly, but pid file is not removed by iscsid
rm -f $PID_FILE
+
+ ebegin "Removing iSCSI modules"
+ modprobe -r iscsi_tcp
+ modprobe -r scsi_transport_iscsi
+ ret=$?
+ eend $ret
+ [ $ret -gt 0 ] && return $ret
}
opts="${opts} dump"
dump() {
- DUMP=`tempfile -p iscsid`
- RETVAL=$?
- if [ $RETVAL != "0" ]; then
- echo "Failed to create dump file $DUMP"
- return 1
- fi
- /usr/sbin/iscsiadm -m node --record 0a45f8 >$DUMP
- RETVAL=$?
- if [ $RETVAL != "0" ]; then
- echo "Error dumping config from daemon"
- rm $DUMP
- return 1
- fi
- mv -u $DUMP $CONFIG_FILE
- echo "Config dumped to $CONFIG_FILE"
+ einfo "Starting dump of iscsid database (nodes)"
+ NODELIST="$(iscsiadm -m node | awk -F '[\\[\\]]' '{print $2}')"
+ [ -f ${DUMP_NODE} ] && mv -f ${DUMP_NODE} ${DUMP_NODE}.old
+ for i in $NODELIST ; do
+ echo "# $(iscsiadm -m node | egrep "^\[$i\]")" >>${DUMP_NODE}
+ iscsiadm -m node --record=$i >>${DUMP_NODE}
+ echo >>${DUMP_NODE}
+ done
+ einfo "Starting dump of iscsid database (discovery)"
+ DISCOVERYLIST="$(iscsiadm -m discovery | awk -F '[\\[\\]]' '{print $2}')"
+ [ -f ${DUMP_DISCOVERY} ] && mv -f ${DUMP_DISCOVERY} ${DUMP_DISCOVERY}.old
+ for i in $DISCOVERYLIST ; do
+ echo "# $(iscsiadm -m discovery | egrep "^\[$i\]")" >>${DUMP_DISCOVERY}
+ iscsiadm -m discovery --record=$i >>${DUMP_DISCOVERY}
+ echo >>${DUMP_DISCOVERY}
+ done
+
+ einfo "Config dumped to ${DUMP_DIR}/"
}
diff --git a/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild b/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild
index 2c2a90e9e3ed..a40aa904bdd4 100644
--- a/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild
+++ b/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild,v 1.1 2005/09/20 04:33:34 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-block/open-iscsi/open-iscsi-0.4.413.ebuild,v 1.2 2005/09/20 08:00:38 robbat2 Exp $
inherit versionator linux-mod eutils
@@ -8,7 +8,7 @@ DESCRIPTION="Open-iSCSI project is a high performance, transport independent, mu
HOMEPAGE="http://www.open-iscsi.org/"
MY_PV="$(replace_version_separator 2 '-')"
MY_P="${PN}-${MY_PV}"
-SRC_URI="http://dev.gentoo.org/~robbat2/distfiles/${MY_P}.tar.gz"
+SRC_URI="mirror://gentoo/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
@@ -20,7 +20,7 @@ RDEPEND="${DEPEND}
sys-apps/util-linux"
S="${WORKDIR}/${MY_P}"
-MODULE_NAMES_ARG="drivers/scsi:${S}/kernel"
+MODULE_NAMES_ARG="kernel/drivers/scsi:${S}/kernel"
MODULE_NAMES="iscsi_tcp(${MODULE_NAMES_ARG}) scsi_transport_iscsi(${MODULE_NAMES_ARG})"
BUILD_TARGETS="all"
CONFIG_CHECK="CRYPTO_MD5 CRYPTO_CRC32C"
@@ -70,4 +70,15 @@ src_install() {
doins etc/iscsid.conf
doins ${FILESDIR}/initiatorname.iscsi
newinitd ${FILESDIR}/iscsid-init.d iscsid
+
+ # security
+ keepdir /var/db/iscsi
+ fperms 700 /var/db/iscsi
+ fperms 600 /etc/iscsid.conf
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+ [ -d /var/db/iscsi ] && chmod 700 /var/db/iscsi
+ [ -f /etc/iscsid.conf ] && chmod 600 /etc/iscsid.conf
}