diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2005-09-20 08:00:38 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2005-09-20 08:00:38 +0000 |
commit | 8fb0257ba80538992ea7c961f29d45004877e9e5 (patch) | |
tree | a9e924c1e350b0c01fb3685013585e6a32a4e1b3 /sys-block/open-iscsi/files | |
parent | Initial import. Ebuild made by Tomasz Mrugalski <thomson@klub.com.pl>. (diff) | |
download | gentoo-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/files')
-rw-r--r-- | sys-block/open-iscsi/files/iscsid-init.d | 77 |
1 files changed, 36 insertions, 41 deletions
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}/" } |