#!/bin/sh

post_install() {
	if [ -z $(<etc/iscsi/initiatorname.iscsi) ]; then
	  name=$(iscsi-iname)
	  echo
	  echo ">>> Setting Initiatorname '$name'"
	  echo "InitiatorName=$name" >etc/iscsi/initiatorname.iscsi
	fi
}

post_upgrade() {
	post_install

	# return if old package version greater 2.1.9-1
	(( $(vercmp $2 '2.1.9-1') > 0 )) && return

	echo ':: The database home changed from `/etc/iscsi` to `/var/lib/iscsi`.'
	echo '   The migration is not done automatically. Please disconnect targets,'
	echo '   stop the service, migrate and connect again.'
}
