Currently if no InitiatorName is set the init.d stops. checkconfig() { if [ ! -f $CONFIG_FILE ]; then eerror "Config file $CONFIG_FILE does not exist!" return 1 fi if [ ! -f $INITIATORNAME -o -z "$(egrep '^InitiatorName=' "${INITIATORNAME}")" ]; then eerror "$INITIATORNAME should contain a string with your initiatior name, eg:" eerror "InitiatorName=iqn.2005-09.tld.domainname.hostname:initiator-name" eerror "Initiator name file does not exist!" return 1 fi } Wouldn't it be nicer to do such thing: checkconfig() { if [ ! -f $CONFIG_FILE ]; then eerror "Config file $CONFIG_FILE does not exist!" return 1 fi if [ ! -f $INITIATORNAME -o -z "$(egrep '^InitiatorName=' "${INITIATORNAME}")" ]; then mkdir -p /etc/iscsi/ifaces /etc/iscsi/nodes /etc/iscsi/send_targets eerror "InitiatorName was not set, creating one:" IQN=`date +%Y-%m`.local.`ip addr show dev eth0 | egrep '^ *inet ' | sed 's/ *inet \(.*\)\/.*/\1/g'` UNIQUE=`echo $IQN | md5sum | sed "s/\(.*\) -/\1/g"` INITNAME="iqn.$IQN:openiscsi-$UNIQUE" echo "InitiatorName=$INITNAME" >> $INITIATORNAME eerror "$INITNAME" fi } My implementation leaves the tiny bug as was in the original version, if the file does not exists you cannot egrep it, and leaves an error. Anyway the idea is to create a InitiatorName based in the ip address of the machine, or maybe ever better a hostname. In my scenario I cannot trust on the hostname, so I choose this solution. Reproducible: Always Steps to Reproduce:
Please, attach a unified diff. Don't paste stuff inline, it kills formatting completely.
Created attachment 137028 [details, diff] Unified diff...
kingtaco: yours now.
Fixed here: http://bugs.gentoo.org/show_bug.cgi?id=196096 Please close the bug.
Thanks for using Craig!