slackbuilds_ponce/network/iscsitarget/doinst.sh
mario da30a3f51b network/iscsitarget: Added (FOSS iSCSI target)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2010-06-17 14:42:19 -05:00

31 lines
752 B
Bash

config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
preserve_perms etc/rc.d/rc.iscsi-target.new
config etc/iet/initiators.allow.new
config etc/iet/targets.allow.new
config etc/iet/ietd.conf.new
chroot . /sbin/depmod -a 2>/dev/null 1>/dev/null