#!/bin/bash

. ${TOOLKIT}-functions.sh

file=/etc/iscsi/initiatorname.iscsi
grep -q 'debian:01:' $file && {
	putwarning initiatorname \
		"patching $file, replacing :01: with acutal hostname;" \
		"please check/modify external targets, if any!"

	hostname=$(uname -n)
	sed -e "s/debian:01:/debian:$hostname:/" $file >$file.tmp
	installfile $file.tmp $file root:root 440
}

$SOMETHING_CHANGED && {
	restart_service open-iscsi iscsid || exit 1
}

exit 0
