- ensure that we respect %{optflags}

- cleaned up initscript to make use of standard functions, return right
    values and start by default
- build iscsistart as a static binary for use in initrds
This commit is contained in:
Jeremy Katz 2006-06-21 03:56:34 +00:00
parent a68e533029
commit 3b954e8cf2
3 changed files with 117 additions and 12 deletions

View File

@ -1,12 +1,15 @@
Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.0.5.595
Release: 0
Release: 1
Source0: http://people.redhat.com/mchristi/iscsi/FC6/open-iscsi/rpm/open-iscsi-%{version}.tar.bz2
Source1: iscsi.init
Patch0: open-iscsi-5.0.5.595-update-initscripts-and-docs.patch
Patch1: open-iscsi-5.0.5.595-add-iscsi-iname.patch
Patch2: open-iscsi-5.0.5.595-rm-reopen-max.patch
Patch3: open-iscsi-5.0.5.595-fc-version.patch
Patch4: iscsi-initiator-utils-cflags.patch
Patch5: iscsistart-static.patch
Group: System Environment/Daemons
License: GPL
@ -23,21 +26,19 @@ for distributed disk access using SCSI commands sent over Internet
Protocol networks.
%prep
%setup -q -n %{name}-%{version} -c
cd open-iscsi-%{version}
%setup -q -n open-iscsi-%{version}
%patch0 -p1 -b .update-initscripts-and-docs
%patch1 -p1 -b .add-iscsi-iname
%patch2 -p1 -b .rm-reopen-max
%patch3 -p1 -b .fc-version
%patch4 -p1 -b .cflags
%patch5 -p1 -b .static
%build
cd open-iscsi-%{version}
make -C usr
make -C utils
make OPTFLAGS="%{optflags}" -C usr
make OPTFLAGS="%{optflags}" -C utils
%install
cd open-iscsi-%{version}
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
@ -46,9 +47,11 @@ mkdir -p $RPM_BUILD_ROOT/var/db/iscsi/
install -s -m 755 usr/iscsid usr/iscsiadm utils/iscsi-iname usr/iscsistart $RPM_BUILD_ROOT/sbin
install -m 644 doc/iscsiadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -m 644 doc/iscsid.8 $RPM_BUILD_ROOT/%{_mandir}/man8
install -m 755 etc/initd/initd.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
#install -m 755 etc/initd/initd.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
install -m 644 etc/iscsid.conf $RPM_BUILD_ROOT/etc
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi
%clean
rm -rf $RPM_BUILD_ROOT
@ -56,7 +59,6 @@ rm -rf $RPM_BUILD_ROOT
if [ ! -f /etc/initiatorname.iscsi ]; then
echo "InitiatorName=`/sbin/iscsi-iname`" > /etc/initiatorname.iscsi
fi
/sbin/chkconfig --add iscsi
%preun
@ -66,14 +68,20 @@ fi
%files
%defattr(-,root,root)
%doc README
%config /etc/rc.d/init.d/iscsi
%attr(600,root,root) %config(noreplace) /etc/iscsid.conf
%doc open-iscsi-%{version}/README
%attr(0600,root,root) %config(noreplace) /etc/iscsid.conf
%dir /var/db/iscsi
/sbin/*
%{_mandir}/*/*
%changelog
* Tue Jun 20 2006 Jeremy Katz <katzj@redhat.com> - 6.0.5.595-1
- ensure that we respect %%{optflags}
- cleaned up initscript to make use of standard functions, return right
values and start by default
- build iscsistart as a static binary for use in initrds
* Tue May 30 2006 Mike Christie <mchristi@redhat.com>
- rebase package to svn rev 595 to fix several bugs
NOTE!!!!!!!! This is not compatible with the older open-iscsi modules

86
iscsi.init Executable file
View File

@ -0,0 +1,86 @@
#!/bin/sh
#
# chkconfig: 345 13 89
# description: Starts and stops the iSCSI initiator
#
# processname: iscsid
# pidfile: /var/run/iscsid.pid
# config: /etc/iscsid.conf
# Source function library.
. /etc/init.d/functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
RETVAL=0
start()
{
echo -n $"Starting iSCSI initiator service: "
modprobe -q iscsi_tcp
daemon iscsid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] || return
touch /var/lock/subsys/iscsi
echo -n $"Setting up iSCSI targets: "
TARGETS=`iscsiadm -m node 2> /dev/null | sed 's@\[\(.*\)\] .*@\1@g'`
for rec in $TARGETS; do
STARTUP=`iscsiadm -m node -r $rec | grep "node.startup" | cut -d' ' -f3`
if [ $STARTUP = "automatic" ]; then
iscsiadm -m node -r $rec -l
fi
done
success
echo
}
stop()
{
echo -n $"Stopping iSCSI initiator service: "
sync
TARGETS=`iscsiadm -m session | grep "\[*\]" | sed 's@\[\(.*\)\] .*@\1@g'`
for rec in $TARGETS; do
iscsiadm -m node -r $rec -u
done
killproc iscsid
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/iscsi
modprobe -r iscsi_tcp 2>/dev/null
}
restart()
{
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status iscsid
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/iscsi ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|status|condrestart}"
exit 1
esac
exit $RETVAL

11
iscsistart-static.patch Normal file
View File

@ -0,0 +1,11 @@
--- open-iscsi-6.0.5.595/usr/Makefile.static 2006-06-20 23:21:15.000000000 -0400
+++ open-iscsi-6.0.5.595/usr/Makefile 2006-06-20 23:22:59.000000000 -0400
@@ -51,7 +51,7 @@
$(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) iscsistart.o
- $(CC) $(CFLAGS) $^ -o $@
+ $(CC) -static $(CFLAGS) $^ -o $@
clean:
rm -f *.o $(PROGRAMS)