]>
Commit | Line | Data |
---|---|---|
7b7e198b AM |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without dist_kernel # allow non-distribution kernel | |
4 | %bcond_without kernel # don't build kernel modules | |
5 | %bcond_without smp # don't build SMP module | |
6 | %bcond_without userspace # don't build userspace module | |
7 | %bcond_with verbose # verbose build (V=1) | |
8 | # | |
ac619853 ER |
9 | %define _rc rc7-383 |
10 | %define _rel 0.1 | |
7b7e198b | 11 | Summary: iSCSI - SCSI over IP |
eb81d565 | 12 | Summary(pl.UTF-8): iSCSI - SCSI po IP |
7b7e198b AM |
13 | Name: open-iscsi |
14 | Version: 0.3 | |
7b7e198b AM |
15 | Release: %{_rel} |
16 | License: GPL | |
17 | Group: Base/Kernel | |
18 | Source0: http://www.open-iscsi.org/bits/%{name}-%{version}%{_rc}.tar.gz | |
19 | # Source0-md5: 5009c7f2756b8c08d1000dee6dc600c1 | |
20 | Source1: %{name}.init | |
21 | Source2: %{name}.sysconfig | |
22 | URL: http://www.open-iscsi.org/ | |
7b7e198b | 23 | BuildRequires: db-devel |
ac619853 ER |
24 | %{?with_dist_kernel:BuildRequires: kernel-headers >= 2.6.0} |
25 | BuildRequires: rpmbuild(macros) >= 1.268 | |
26 | Requires(post,preun): /sbin/chkconfig | |
27 | Requires: rc-scripts | |
7b7e198b AM |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
29 | ||
30 | %define _sbindir /sbin | |
31 | ||
32 | %description | |
33 | The Linux iSCSI driver acts as an iSCSI protocol initiator to | |
34 | transport SCSI requests and responses over an IP network between the | |
35 | client and an iSCSI-enabled target device such as a Cisco SN 5420 | |
36 | storage router. The iSCSI protocol is an IETF-defined protocol for IP | |
37 | storage. For more information about the iSCSI protocol, refer to the | |
38 | IETF standards for IP storage at <http://www.ietf.org/>. | |
39 | ||
b6d977e4 JR |
40 | %description -l pl.UTF-8 |
41 | Sterownik Linux iSCSI zachowuje się jak inicjator protokołu iSCSI do | |
42 | transportu zleceń SCSI i odpowiedzi po sieci IP między klientem a | |
43 | urządzeniem docelowym obsługującym iSCSI, takim jak Cisco SN 5420. | |
44 | Protokół iSCSI jest zdefiniowany przez IETF do składowania IP. Więcej | |
45 | informacji o protokole iSCSI znajduje się w standardach IETF na | |
7b7e198b AM |
46 | <http://www.ietf.org/>. |
47 | ||
48 | %package -n kernel-iscsi | |
49 | Summary: ISCSI kernel module | |
eb81d565 | 50 | Summary(pl.UTF-8): Moduł jądra ISCSI |
7b7e198b AM |
51 | Release: %{_rel}@%{_kernel_ver_str} |
52 | Group: Base/Kernel | |
53 | Requires: %{name} = %{version}-%{_rel} | |
54 | ||
55 | %description -n kernel-iscsi | |
56 | IP over SCSI kernel module. | |
57 | ||
b6d977e4 JR |
58 | %description -n kernel-iscsi -l pl.UTF-8 |
59 | Moduł jądra dla protokołu IP over SCSI. | |
7b7e198b AM |
60 | |
61 | %package -n kernel-smp-iscsi | |
62 | Summary: ISCSI SMP kernel module | |
eb81d565 | 63 | Summary(pl.UTF-8): Moduł jądra SMP ISCSI |
7b7e198b AM |
64 | Release: %{_rel}@%{_kernel_ver_str} |
65 | Group: Base/Kernel | |
66 | Requires: %{name} = %{version}-%{_rel} | |
67 | ||
68 | %description -n kernel-smp-iscsi | |
69 | IP over SCSI SMP kernel module. | |
70 | ||
b6d977e4 JR |
71 | %description -n kernel-smp-iscsi -l pl.UTF-8 |
72 | Moduł jądra SMP dla protokołu IP over SCSI. | |
7b7e198b AM |
73 | |
74 | %prep | |
75 | %setup -q -n %{name}-%{version}%{_rc} | |
76 | ||
77 | %build | |
78 | %if %{with kernel} | |
79 | cd kernel | |
80 | %if "%{_kernel_ver}" < "2.6.12.0" | |
81 | # fix the patch | |
82 | grep -B 1000 -m 1 'Index: backward-compile-2.6.11.patch' backward-compile-2.6.11.patch > backward-compile-2.6.11n.patch | |
83 | grep -A 1000 'Index: scsi_transport_iscsi.c' backward-compile-2.6.11.patch >> backward-compile-2.6.11n.patch | |
84 | patch < backward-compile-2.6.11n.patch | |
85 | %else | |
86 | %if "%{_kernel_ver}" < "2.6.13.0" | |
87 | patch < backward-compile-2.6.12.patch | |
88 | %endif | |
89 | %endif | |
90 | ||
91 | # kernel module(s) | |
92 | for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do | |
93 | if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then | |
94 | exit 1 | |
95 | fi | |
96 | rm -rf include | |
97 | install -d include/{linux,config} | |
98 | ln -sf %{_kernelsrcdir}/config-$cfg .config | |
99 | ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h | |
100 | ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm | |
26a644c8 | 101 | ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers |
7b7e198b AM |
102 | touch include/config/MARKER |
103 | ||
104 | %{__make} -C %{_kernelsrcdir} clean \ | |
105 | RCS_FIND_IGNORE="-name '*.ko' -o" \ | |
106 | M=$PWD O=$PWD \ | |
107 | %{?with_verbose:V=1} | |
108 | %{__make} -C %{_kernelsrcdir} modules \ | |
109 | CC="%{__cc}" \ | |
110 | M=$PWD O=$PWD \ | |
111 | %{?with_verbose:V=1} | |
112 | mv iscsi_tcp{,-$cfg}.ko | |
113 | mv scsi_transport_iscsi{,-$cfg}.ko | |
114 | done | |
115 | cd .. | |
116 | %endif | |
117 | ||
118 | %if %{with userspace} | |
119 | %{__make} -C usr \ | |
120 | CC="%{__cc}" \ | |
121 | CFLAGS="%{rpmcflags} -I../include -DLinux -DNETLINK_ISCSI=12" | |
122 | %endif | |
123 | ||
124 | %install | |
125 | rm -rf $RPM_BUILD_ROOT | |
126 | install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{1,5,8},/etc/{rc.d/init.d,sysconfig}} | |
127 | ||
128 | %if %{with kernel} | |
129 | install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc | |
130 | ||
131 | install kernel/iscsi_tcp-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \ | |
132 | $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/iscsi_tcp.ko | |
133 | install kernel/scsi_transport_iscsi-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \ | |
134 | $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/scsi_transport_iscsi.ko | |
135 | ||
136 | %if %{with smp} && %{with dist_kernel} | |
137 | install kernel/iscsi_tcp-smp.ko \ | |
138 | $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/iscsi_tcp.ko | |
139 | install kernel/scsi_transport_iscsi-smp.ko \ | |
140 | $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/scsi_transport_iscsi.ko | |
141 | %endif | |
142 | %endif | |
143 | ||
144 | %if %{with userspace} | |
145 | install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/iscsi | |
146 | install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/iscsi | |
147 | ||
ac619853 | 148 | :> $RPM_BUILD_ROOT%{_sysconfdir}/initiatorname.iscsi |
7b7e198b | 149 | |
ac619853 | 150 | install etc/iscsid.conf $RPM_BUILD_ROOT%{_sysconfdir} |
7b7e198b AM |
151 | |
152 | install usr/iscsid usr/iscsiadm $RPM_BUILD_ROOT%{_sbindir} | |
153 | %endif | |
154 | ||
155 | %clean | |
156 | rm -rf $RPM_BUILD_ROOT | |
157 | ||
158 | %post -n kernel-iscsi | |
159 | %depmod %{_kernel_ver} | |
160 | ||
161 | %postun -n kernel-iscsi | |
162 | %depmod %{_kernel_ver} | |
163 | ||
164 | %post -n kernel-smp-iscsi | |
165 | %depmod %{_kernel_ver}smp | |
166 | ||
167 | %postun -n kernel-smp-iscsi | |
168 | %depmod %{_kernel_ver}smp | |
169 | ||
170 | %post | |
ac619853 ER |
171 | if ! grep -q "^InitiatorName=[^ \t\n]" %{_sysconfdir}/initiatorname.iscsi 2>/dev/null ; then |
172 | echo "InitiatorName=$(hostname -f)" >> %{_sysconfdir}/initiatorname.iscsi | |
7b7e198b AM |
173 | fi |
174 | ||
ac619853 ER |
175 | /sbin/chkconfig --add iscsi |
176 | #%%service iscsi restart | |
177 | ||
7b7e198b AM |
178 | %preun |
179 | if [ "$1" = "0" ]; then | |
ac619853 | 180 | %service iscsi stop |
7b7e198b AM |
181 | /sbin/chkconfig --del iscsi |
182 | fi | |
183 | ||
184 | %if %{with userspace} | |
185 | %files | |
186 | %defattr(644,root,root,755) | |
187 | %doc README THANKS TODO | |
188 | %attr(755,root,root) %{_sbindir}/* | |
ac619853 | 189 | %attr(750,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/iscsid.conf |
a99e43e3 | 190 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/initiatorname.iscsi |
ac619853 | 191 | %attr(754,root,root) /etc/rc.d/init.d/iscsi |
7b7e198b AM |
192 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/iscsi |
193 | %endif | |
194 | ||
195 | %if %{with kernel} | |
196 | %files -n kernel-iscsi | |
197 | %defattr(644,root,root,755) | |
a99e43e3 | 198 | /lib/modules/%{_kernel_ver}/misc/* |
7b7e198b AM |
199 | |
200 | %if %{with smp} && %{with dist_kernel} | |
201 | %files -n kernel-smp-iscsi | |
202 | %defattr(644,root,root,755) | |
a99e43e3 | 203 | /lib/modules/%{_kernel_ver}smp/misc/* |
7b7e198b AM |
204 | %endif |
205 | %endif |