rhel3-disable-fedorakmod-20080707
[openafs.git] / src / packaging / RedHat / openafs.spec.in
1 # Openafs Spec $Revision$
2
3 %define afsvers @VERSION@
4 %define pkgvers @LINUX_PKGVER@
5 # for beta/rc releases make pkgrel 0.X.<tag>
6 # for real releases make pkgrel 1 (or more for extra releases)
7 #%define pkgrel 0.1.rc1
8 %define pkgrel @LINUX_PKGREL@
9
10 %if %{?osvers:0}%{!?osvers:1}
11 %define osvers 1
12 %endif
13
14 %{!?fedorakmod: %define fedorakmod 1}
15 %{!?build_dkmspkg: %define build_dkmspkg 1}
16
17 # Determine presence of rpmbuild command line --define arguments used for
18 # option specification
19 %define kernvers_on_cmdline %{?kernvers:1}%{!?kernvers:0}
20 %define build_userspace_on_cmdline %{?build_userspace:1}%{!?build_userspace:0}
21 %define build_modules_on_cmdline %{?build_modules:1}%{!?build_modules:0}
22
23 # Determine the version of the kernel to build against
24 # - automatically select running kernel if there are sources in /lib/modules
25 # - note that this can be overridden on the command line
26 #
27 %if !%{kernvers_on_cmdline}
28 %define kernvers %(%{_sourcedir}/openafs-kernel-version.sh)
29 %endif
30
31 # If we're building for a 2.4 series kernel, then fedora style kmods aren't
32 # appropriate - disable them.
33
34 %define kern24 %([ `echo "%{kernvers}" | sed -e 's/^\([0-9]*\.[0-9]*\)\..*/\1/'` = "2.4" ] && echo 1 || echo 0)
35
36 %if %{kern24}
37 %define fedorakmod 0
38 %endif
39
40 %if %{fedorakmod}
41 %define kmodtool bash %{_sourcedir}/openafs-kmodtool
42
43 %define kmod_name openafs
44 %define kverrel %(%{kmodtool} verrel %{?kernvers} 2>/dev/null)
45
46 %define upvar ""
47 %{!?kvariants: %define kvariants %{?upvar}}
48
49 %if %{?ksrcdir:1}%{!?ksrcdir:0}
50   if ( -d %{_usrsrc}/kernels/%{kverrel}-%{_target_cpu}) ; then
51     %define ksrcdir %{_usrsrc}/kernels/%{kverrel}-%{_target_cpu}}
52   else
53     %define ksrcdir %{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}}
54   fi
55 %endif
56
57 %else # Legacy kernel build stuff 
58
59 %define kversis %{_sourcedir}/openafs-kvers-is.sh
60 %define kvers %(%{kversis} parsev %{kernvers})
61 %define kvers_is_24 %(%{kversis} %{kvers} "2.4")
62 %define kvers_is_26 %(%{kversis} %{kvers} "2.6")
63 %define ktype %(%{kversis} parset %{kernvers})
64 %define kversion %(%{kversis} kvers %{kernvers})
65
66 # This is where to look for kernel build include files.  Default
67 # is /lib/modules/<kvers>/build, but you can define kbase and
68 # kend on the commandline to change that.
69 #
70 %if %{?kbase:0}%{!?kbase:1}
71 %define kbase /lib/modules/
72 %endif
73 %if %{?kend:0}%{!?kend:1}
74 %define kend /build
75 %endif
76 # Let the buildscript define the ksrcdir directly -- needed for RHEL4
77 %if %{?ksrcdir:0}%{!?ksrcdir:1}
78 %define ksrcdir %{kbase}%{kernvers}%{kend}
79 %endif
80
81 %if %{?kmoddir:0}%{!?kmoddir:1}
82 %define kmoddir /lib/modules
83 %endif
84 %define kxmoddir %{kmoddir}/%{kernvers}
85
86 # End legacy kernel build stuff
87 %endif 
88
89 %define dkms_version %{osvers}.%{pkgrel}
90
91 # Set 'debugspec' to 1 if you want to debug the spec file.  This will
92 # not remove the installed tree as part of the %clean operation
93 %if %{?debugspec:0}%{!?debugspec:1}
94 %define debugspec 0
95 %endif
96
97 # Set 'krb5support' to 1 if you want to build the openafs-krb5 package
98 # to distribute aklog and asetkey
99 %define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
100
101 %if %{krb5support}
102 %if %{?krb5config:0}%{!?krb5config:1}
103 %define krb5config /usr/kerberos/bin/krb5-config
104 %endif
105 %endif
106
107 # Set 'bootkernelsupport' to 1 if you want to build the
108 # kernel module for Red Hat BOOT Kernels on x86.
109 %define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
110
111 # Define the location of your init.d directory
112 %define initdir /etc/init.d
113
114 #determine if the kernel provides an arch-specific Provides
115 %define kprovidesarch %(%{kversis} provideskernelarch %{ksrcdir} %{_target_cpu})
116
117 # Define the location of the PAM security module directory
118 %define pamdir /%{_lib}/security
119
120 %if !%{fedorakmod}
121
122 # Define the set of kernel module variations to be built:
123 # For 2.4 kernels we just build everything at once for a particular
124 # kernel.   So we build up, smp, and bigmem all at once.
125 # For 2.6 kernels we have to build against the specific kernel headers
126 # for a particular kernel variation.  AFS will handle the specific smp or
127 # non-smp determination.  So just always build as if it's "up" -- the kernel
128 # version will have the 'variation' type already in the version #.
129
130 %define up_package 0
131 %define smp_package 0
132 %define bigmem_package 0
133 %define hugemem_package 0
134 %define largesmp_package 0
135
136 #######################################################################
137 # 2.4
138 %if %{kvers_is_24}
139 %define kdepend kernel-source
140 %define up_package 1
141 %define smp_package 1
142 %define smp_ext smp
143
144 %define bigmem_package %(%{kversis} find %{ksrcdir} %{_target_cpu} bigmem) 
145 %if %{bigmem_package}
146 %define bigmem_ext bigmem
147 %endif
148
149 %define hugemem_package %(%{kversis} find %{ksrcdir} %{_target_cpu} hugemem) 
150 %if %{hugemem_package}
151 %define hugemem_ext hugemem
152 %endif
153
154 %define kvariations up smp %{?bigmem_ext:%{bigmem_ext}} %{?hugemem_ext:%{hugemem_ext}}
155
156 #######################################################################
157 # 2.6
158 %else
159 %if %{kvers_is_26}
160 %define kvariations up
161 %ifarch s390x
162 %define ktype "smp"
163 %define up_package 1
164 %else
165 %define up_package %(%{kversis} "%{ktype}" "")
166 %define smp_package %(%{kversis} "%{ktype}" "smp")
167 %define hugemem_package %(%{kversis} "%{ktype}" "hugemem")
168 %define largesmp_package %(%{kversis} "%{ktype}" "largesmp")
169 %endif
170
171 %if !%{up_package} && !%{smp_package} && !%{hugemem_package} && !%{largesmp_package}
172 %error "unknown kernel type: %{ktype}"
173 %endif
174
175 %if !%{kernvers_on_cmdline}
176 %define kdepend %{ksrcdir}/include/linux/version.h
177 %endif
178
179 #######################################################################
180 # other kernels?
181 %else
182 %error "unknown kernel version: ${kvers} (parsed from %{kernvers})"
183 %endif
184 %endif
185
186 # End of legacy kernel module build
187 %endif 
188
189 #######################################################################
190 # You probably don't need to change anything beyond this line
191 # NOTE: If you do, please email me!!!
192
193 # Determine which elements of OpenAFS to build.  For non-x86 arches
194 # (subject to the ExclusiveArch setting, below), we build both userspace
195 # and modules.  For most x86 arches, we build just the kernel modules.  For
196 # i386, we build just the userspace.  If you're running an i386 kernel,
197 # you'll need to tweak that last bit.
198 %if !%{build_userspace_on_cmdline} && !%{build_modules_on_cmdline}
199
200 %ifarch x86_64 ia64 s390 s390x
201 %define build_userspace 1
202 %define build_modules 1
203 %ifarch x86_64 ia64
204 %define build_authlibs 1
205 %else
206 %define build_authlibs 0
207 %endif
208 %endif
209
210 %ifarch %{ix86}
211 %define build_userspace 0
212 %define build_modules 1
213 %define build_authlibs 1
214 %endif
215
216 %ifarch i386
217 %define build_userspace 1
218 %define build_modules 0
219 %define build_authlibs 1
220 %endif
221
222 %endif
223
224 # deal with cmdline specification
225 %if %{build_userspace_on_cmdline} || %{build_modules_on_cmdline}
226 %if !%{build_userspace_on_cmdline}
227 %define build_userspace 0
228 %endif
229 %if !%{build_modules_on_cmdline}
230 %define build_modules 0
231 %endif
232 %endif
233
234 # Make sure RPM doesn't complain about installed but non-packaged files.
235 #define __check_files  %{nil}
236
237 Summary: OpenAFS distributed filesystem
238 Name: openafs
239 Version: %{pkgvers}
240 Release: %{osvers}.%{pkgrel}
241 License: IBM Public License
242 URL: http://www.openafs.org
243 BuildRoot: %{_tmppath}/%{name}-%{version}-root
244 Packager: OpenAFS Gatekeepers <openafs-gatekeepers@openafs.org>
245 Group: Networking/Filesystems
246 BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel, flex, bison
247 %if %{krb5support}
248 BuildRequires: krb5-devel
249 %endif
250 ExclusiveArch: %{ix86} x86_64 ia64 s390 s390x sparc64 ppc ppc64
251
252 #    http://dl.openafs.org/dl/openafs/candidate/%{afsvers}/...
253 Source0: http://www.openafs.org/dl/openafs/%{afsvers}/openafs-%{afsvers}-src.tar.bz2
254 Source1: http://www.openafs.org/dl/openafs/%{afsvers}/openafs-%{afsvers}-doc.tar.bz2
255 %define srcdir openafs-%{afsvers}
256
257 Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
258 Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
259
260 Source20: http://dl.central.org/dl/cellservdb/CellServDB.2008-04-23
261
262 Source30: openafs-kernel-version.sh
263 Source996: openafs-kvers-is.sh
264 Source997: openafs-buildfedora.pl
265 Source998: openafs-buildall.sh
266 Source999: openafs-kmodtool
267
268 Patch0:  openafs-1.4.0-kmodule26.patch
269
270 %description
271 The AFS distributed filesystem.  AFS is a distributed filesystem
272 allowing cross-platform sharing of files among multiple computers.
273 Facilities are provided for access control, authentication, backup and
274 administrative management.
275
276 This package provides common files shared across all the various
277 OpenAFS packages but are not necessarily tied to a client or server.
278
279 The OpenAFS SRPM can be rebuilt with the following options to control
280 what gets built:
281
282  --define "kernvers 2.4.20-1.1376_FC3" Specify the specific kernel version 
283                                   to build modules against. The default is
284                                   to build against the currently-running
285                                   kernel.
286  --define "kbase /lib/modules/"   The base location to look for kernel headers
287  --define "kend /build"           The 'end' location to look for kernels
288                                   The build will define ksrvdir as
289                                   %%{kbase}<kernvers>%%{kend}
290
291  --without krb5                   Disable krb5 support (default: with krb5)
292  --with bitmap-later              Enable "bitmap later" support
293  --with bos-restricted            Enable "bos restricted" mode
294  --with fast-restart              Enable "fast restart" mode
295  --with largefiles                Enable "largefile fileserver" mode
296  --with supergroups               Enable "supergroups"
297
298  --target=i386                    The target architecture to build for.
299                                   When building for a non-default target
300                                   the build may choose whether to build
301                                   userspace or kernel modules automatically.
302                                   The defaults are probably what you want.
303
304  --define "build_userspace 1"     Request building of userspace tools
305  --define "build_modules 1"       Request building of kernel modules
306                                   You probably never need to specify these.
307
308  --define "kmoddir /lib/modules"  This is the base location where modules
309                                   will be installed.  You probably don't
310                                   need to change this ever.
311
312  --define "fedorakmod 0"          Disable the building of 'Fedora' style kernel 
313                                   modules, and use the old format.
314
315  --define "kvariants <variants>"  When building Fedora style kernel modules,
316                                   this defines the set of kernel variants
317                                   to build.
318                                   <variants> is a space seperated list which
319                                   may contain one or more of
320                                   '' (for the generic kernel), smp, PAE, xen
321                                   or kdump 
322
323 To a kernel module for your running kernel, just run:
324   rpmbuild --rebuild --target=`uname -m` openafs-%{pkgvers}-%{osvers}.%{pkgrel}.src.rpm
325
326 ##############################################################################
327 #
328 # build the userspace side of things if so requested
329 #
330 ##############################################################################
331 %if %{build_userspace}
332
333 %package client
334 Requires: binutils, openafs = %{PACKAGE_VERSION}
335
336 %if %{fedorakmod}
337 Requires: %{name}-kmod >= %{version}
338 Provides: %{name}-kmod-common = %{version}
339 %else
340 Requires: openafs-kernel
341 %endif
342
343 Summary: OpenAFS Filesystem Client
344 Group: Networking/Filesystem
345
346 %description client
347 The AFS distributed filesystem.  AFS is a distributed filesystem
348 allowing cross-platform sharing of files among multiple computers.
349 Facilities are provided for access control, authentication, backup and
350 administrative management.
351
352 This package provides basic client support to mount and manipulate
353 AFS.
354
355 %package server
356 Requires: openafs = %{PACKAGE_VERSION}
357 Summary: OpenAFS Filesystem Server
358 Group: Networking/Filesystems
359
360 %description server
361 The AFS distributed filesystem.  AFS is a distributed filesystem
362 allowing cross-platform sharing of files among multiple computers.
363 Facilities are provided for access control, authentication, backup and
364 administrative management.
365
366 This package provides basic server support to host files in an AFS
367 Cell.
368
369 %if %{build_dkmspkg}
370 %package -n dkms-%{name}
371 Summary:        DKMS-ready kernel source for AFS distributed filesystem
372 Group:          Development/Kernel
373 Provides:       openafs-kernel = %{PACKAGE_VERSION}
374 %if %{fedorakmod}
375 Provides: %{name}-kmod = %{PACKAGE_VERSION}
376 %endif
377 Requires(pre):  dkms
378 Requires(pre):  flex
379 Requires(post): dkms
380 Requires:       %{name}-kmod-common = %{version}
381
382 %description -n dkms-%{name}
383 The AFS distributed filesystem.  AFS is a distributed filesystem
384 allowing cross-platform sharing of files among multiple computers.
385 Facilities are provided for access control, authentication, backup and
386 administrative management.
387
388 This package provides the source code to allow DKMS to build an
389 AFS kernel module.
390 %endif
391
392 %if %{build_authlibs}
393 %package authlibs
394 Summary: OpenAFS authentication shared libraries
395 Group: Networking/Filesystems
396
397 %description authlibs
398 The AFS distributed filesystem.  AFS is a distributed filesystem
399 allowing cross-platform sharing of files among multiple computers.
400 Facilities are provided for access control, authentication, backup and
401 administrative management.
402
403 This package provides a shared version of libafsrpc and libafsauthent. 
404 None of the programs included with OpenAFS currently use these shared 
405 libraries; however, third-party software that wishes to perform AFS 
406 authentication may link against them.
407 %endif
408
409 %package authlibs-devel
410 %if %{build_authlibs}
411 Requires: openafs-authlibs = %{PACKAGE_VERSION}
412 %endif
413 Requires: openafs-devel = %{PACKAGE_VERSION}
414 Summary: OpenAFS shared library development
415 Group: Development/Filesystems
416
417 %description authlibs-devel
418 The AFS distributed filesystem.  AFS is a distributed filesystem
419 allowing cross-platform sharing of files among multiple computers.
420 Facilities are provided for access control, authentication, backup and
421 administrative management.
422
423 This package includes the static versions of libafsrpc and 
424 libafsauthent, and symlinks required for building against the dynamic 
425 libraries.
426
427 %package devel
428 Summary: OpenAFS Development Libraries and Headers
429 Group: Development/Filesystems
430
431 %description devel
432 The AFS distributed filesystem.  AFS is a distributed filesystem
433 allowing cross-platform sharing of files among multiple computers.
434 Facilities are provided for access control, authentication, backup and
435 administrative management.
436
437 This package provides static development libraries and headers needed
438 to compile AFS applications.  Note: AFS currently does not provide
439 shared libraries.
440
441 %package docs
442 Summary: OpenAFS user and administrator documentation
443 Requires: openafs = %{PACKAGE_VERSION}
444 Group: Networking/Filesystems
445
446 %description docs
447 The AFS distributed filesystem.  AFS is a distributed filesystem
448 allowing cross-platform sharing of files among multiple computers.
449 Facilities are provided for access control, authentication, backup and
450 administrative management.
451
452 This package provides HTML documentation for OpenAFS users and system
453 administrators.
454
455 %package kernel-source
456 Summary: OpenAFS Kernel Module source tree
457 Group: Networking/Filesystems
458 Provides: openafs-kernel = %{PACKAGE_VERSION}
459 %if %{fedorakmod}
460 Provides: %{name}-kmod = %{PACKAGE_VERSION}
461 %endif
462
463 %description kernel-source
464 The AFS distributed filesystem.  AFS is a distributed filesystem
465 allowing cross-platform sharing of files among multiple computers.
466 Facilities are provided for access control, authentication, backup and
467 administrative management.
468
469 This package provides the source code to build your own AFS kernel
470 module.
471
472 %package compat
473 Summary: OpenAFS client compatibility symlinks
474 Requires: openafs = %{PACKAGE_VERSION}, openafs-client = %{PACKAGE_VERSION}
475 Group: Networking/Filesystems
476 Obsoletes: openafs-client-compat
477
478 %description compat
479 The AFS distributed filesystem.  AFS is a distributed filesystem
480 allowing cross-platform sharing of files among multiple computers.
481 Facilities are provided for access control, authentication, backup and
482 administrative management.
483
484 This package provides compatibility symlinks in /usr/afsws.  It is
485 completely optional, and is only necessary to support legacy
486 applications and scripts that hard-code the location of AFS client
487 programs.
488
489 %package kpasswd
490 Summary: OpenAFS KA kpasswd support
491 Requires: openafs
492 Group: Networking/Filesystems
493
494 %description kpasswd
495 The AFS distributed filesystem.  AFS is a distributed filesystem
496 allowing cross-platform sharing of files among multiple computers.
497 Facilities are provided for access control, authentication, backup and
498 administrative management.
499
500 This package provides the compatibility symlink for kpasswd, in case
501 you are using KAserver instead of Krb5.
502
503 %if %{krb5support}
504 %package krb5
505 Summary: OpenAFS programs to use with krb5
506 Requires: openafs = %{PACKAGE_VERSION}
507 Group: Networking/Filesystems
508 BuildRequires: krb5-devel
509
510 %description krb5
511 The AFS distributed filesystem.  AFS is a distributed filesystem
512 allowing cross-platform sharing of files among multiple computers.
513 Facilities are provided for access control, authentication, backup and
514 administrative management.
515
516 This package provides compatibility programs so you can use krb5
517 to authenticate to AFS services, instead of using AFS's homegrown
518 krb4 lookalike services.
519 %endif
520
521 %endif
522
523 ##############################################################################
524 #
525 # build the kernel modules if so requested
526 #
527 ##############################################################################
528 %if %{build_modules}
529
530 %if %{fedorakmod}
531 %{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null)}
532
533 %else
534
535 # Legacy kernel compilation code here ...
536 %define modkversion %(echo %{kernvers} | cut -d- -f1)
537 %define modkrelease %(echo %{kernvers} | cut -d- -f2)
538 %define modpkgrel %{modkversion}_%{modkrelease}_%{pkgrel}
539
540 %if %{up_package}
541 %package kernel
542 Summary: OpenAFS Kernel Module (compiled for UP)
543 Release: %{modpkgrel}
544 Group: Networking/Filesystems
545 Provides: openafs-kernel = %{PACKAGE_VERSION}
546 %if %{kprovidesarch}
547 Requires: kernel-%{_target_cpu} = %{kversion}
548 %else
549 Requires: /boot/config-%{kernvers}
550 %endif
551
552 %description kernel
553 The AFS distributed filesystem.  AFS is a distributed filesystem
554 allowing cross-platform sharing of files among multiple computers.
555 Facilities are provided for access control, authentication, backup and
556 administrative management.
557
558 This package provides a precompiled AFS kernel module for %{kernvers}.
559 %endif
560
561 %if %{smp_package}
562 %package kernel-smp
563 Summary: OpenAFS Kernel Module (compiled for SMP)
564 Release: %{modpkgrel}
565 Provides: openafs-kernel = %{PACKAGE_VERSION}
566 %if %{kprovidesarch}
567 Requires: kernel-smp-%{_target_cpu} = %{kversion}
568 %else
569 Requires: /boot/config-%{kernvers}%{?smp_ext:%{smp_ext}}
570 %endif
571 Group: Networking/Filesystems
572
573 %description kernel-smp
574 The AFS distributed filesystem.  AFS is a distributed filesystem
575 allowing cross-platform sharing of files among multiple computers.
576 Facilities are provided for access control, authentication, backup and
577 administrative management.
578
579 This package provides a precompiled AFS kernel module for %{kernvers}.
580 %endif
581
582 %if %{largesmp_package}
583 %package kernel-largesmp
584 Summary: OpenAFS Kernel Module (compiled for LARGESMP)
585 Release: %{modpkgrel}
586 Provides: openafs-kernel = %{PACKAGE_VERSION}
587 %if %{kprovidesarch}
588 Requires: kernel-largesmp-%{_target_cpu} = %{kversion}
589 %else
590 Requires: /boot/config-%{kernvers}%{?largesmp_ext:%{largesmp_ext}}
591 %endif
592 Group: Networking/Filesystems
593
594 %description kernel-largesmp
595 The AFS distributed filesystem.  AFS is a distributed filesystem
596 allowing cross-platform sharing of files among multiple computers.
597 Facilities are provided for access control, authentication, backup and
598 administrative management.
599
600 This package provides a precompiled AFS kernel module for %{kernvers}.
601 %endif
602  
603 %if %{bigmem_package}
604 %package kernel-bigmem
605 Summary: OpenAFS Kernel Module (compiled for SMP & big memory support)
606 Release: %{modpkgrel}
607 Provides: openafs-kernel = %{PACKAGE_VERSION}
608 %if %{kprovidesarch}
609 Requires: kernel-bigmem-%{_target_cpu} = %{kversion}
610 %else
611 Requires: /boot/config-%{kernvers}%{?bigmem_ext:%{bigmem_ext}}
612 %endif
613 Group: Networking/Filesystems
614
615 %description kernel-bigmem
616 The AFS distributed filesystem.  AFS is a distributed filesystem
617 allowing cross-platform sharing of files among multiple computers.
618 Facilities are provided for access control, authentication, backup and
619 administrative management.
620
621 This package provides a precompiled AFS kernel module for %{kernvers}.
622 %endif
623
624 %if %{hugemem_package}
625 %package kernel-hugemem
626 Summary: OpenAFS Kernel Module (compiled for SMP & huge memory support)
627 Release: %{modpkgrel}
628 Provides: openafs-kernel = %{PACKAGE_VERSION}
629 %if %{kprovidesarch}
630 Requires: kernel-hugemem-%{_target_cpu} = %{kversion}
631 %else
632 Requires: /boot/config-%{kernvers}%{?hugemem_ext:%{hugemem_ext}}
633 %endif
634 Group: Networking/Filesystems
635
636 %description kernel-hugemem
637 The AFS distributed filesystem.  AFS is a distributed filesystem
638 allowing cross-platform sharing of files among multiple computers.
639 Facilities are provided for access control, authentication, backup and
640 administrative management.
641
642 This package provides a precompiled AFS kernel module for %{kernvers}.
643 %endif
644
645 %endif
646 # End legacy kernel compilation code ...
647 %endif
648
649 ##############################################################################
650 #
651 # PREP
652 #
653 ##############################################################################
654
655 %prep
656
657 : @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
658 : @@@
659 : @@@ kernel version:     %{kernvers}
660 %if %{fedorakmod}
661 : @@@ kernel variations:  %{kvariants}
662 %else
663 : @@@ base kernel version:%{kversion}
664 : @@@ kernel modules dir: %{kxmoddir}
665 : @@@ kernel source dir:  %{ksrcdir}
666 %if %{kvers_is_24}
667 : @@@ kernel variations:  %{kvariations}
668 %else
669 %if %{up_package}
670 : @@@ kernel type:        up
671 %else
672 : @@@ kernel type:        %{ktype}
673 %endif
674 %endif
675 %endif
676 : @@@ PAM modules dir:    %{pamdir}
677 : @@@ build userspace:    %{build_userspace}
678 : @@@ build modules:      %{build_modules}
679 : @@@ arch:               %{_arch}
680 : @@@ target cpu:         %{_target_cpu}
681 : @@@
682 : @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
683
684 # Install OpenAFS src and doc
685 #%setup -q -n %{srcdir}
686 %setup -q -b 1 -n %{srcdir}
687
688 # Patch openafs to build a kernel module named "openafs" instead of "libafs"
689 %patch0 -p1 -b .kmod26
690
691 ##############################################################################
692 #
693 # building
694 #
695 ##############################################################################
696 %build
697
698 case %{kernvers} in
699    2.4.*)
700        kv='24'
701        ;;
702    2.6.*)
703        kv='26'
704        ;;
705    *)
706        echo "I don't know how to build linux-`expr ${kernvers} : \(^[0-9]*[.][0-9]*\)`"
707        exit 1
708        ;;
709 esac
710
711 case %{_arch} in
712        x86_64)                         sysname=amd64_linux${kv}        ;;
713        alpha*)                         sysname=alpha_linux_${kv}       ;;
714        i386|i486|i586|i686|athlon)     sysname=i386_linux${kv}         ;;
715        *)                              sysname=%{_arch}_linux${kv}     ;;
716 esac
717
718 %ifarch %{ix86}
719 archlist="i386 i586 i686 athlon"
720 %if %{bootkernelsupport}
721   archlist="${archlist} BOOT"
722 %endif
723 %else
724 archlist=%{_arch}
725 %endif
726
727 #
728 # PrintDefine var value statements file
729 #
730 PrintDefine() {
731     case $3 in
732     *ifn*)
733         echo "#ifndef $1" >> $4
734         ;;
735     esac
736     case $3 in
737     *und*)
738         echo "#undef $1" >> $4
739         ;;
740     esac
741     case $3 in
742     *def*)
743         echo "#define $1 $2" >> $4
744         ;;
745     esac
746     case $3 in
747     *end*)
748         echo "#endif" >> $4
749         ;;
750     esac
751     case $3 in
752     *inc*)
753         echo "#include $1" >> $4
754         ;;
755     esac
756     case $3 in
757     *nl*)
758         echo "" >> $4
759         ;;
760     esac
761 }
762
763 # PrintRedhatKernelFix arch mp file
764 PrintRedhatKernelFix() {
765     arch="$1"
766     up=0
767     smp=0
768     largesmp=0
769     ent=0
770     bigmem=0
771     hugemem=0
772     boot=0
773     bootsmp=0
774
775     case "$2" in
776        up)     up=1;;
777        smp)    smp=1;;
778        largesmp) largesmp=1;;
779        bigmem) bigmem=1;;
780        hugemem) hugemem=1;;
781        *)
782                echo "$2 not supported"
783                exit 2;;
784     esac
785
786     file="$3"
787
788     rm -f $file
789     touch $file
790
791     PrintDefine "REDHAT_FIX_H" "" ifn,def,nl $file
792
793     PrintDefine __BOOT_KERNEL_ENTERPRISE $ent     und,def,nl $file
794     PrintDefine __BOOT_KERNEL_BIGMEM     $bigmem  und,def,nl $file
795     PrintDefine __BOOT_KERNEL_HUGEMEM    $hugemem und,def,nl $file
796     PrintDefine __BOOT_KERNEL_SMP        $smp     und,def,nl $file
797     PrintDefine __BOOT_KERNEL_LARGESMP   $largesmp und,def,nl $file
798     PrintDefine __BOOT_KERNEL_UP         $up      und,def,nl $file
799     PrintDefine __BOOT_KERNEL_BOOT       $boot    und,def,nl $file
800     PrintDefine __BOOT_KERNEL_BOOTSMP    $bootsmp und,def,nl $file
801
802     PrintDefine '"/boot/kernel.h"' "" inc,nl $file      # include file
803
804     for ar in $archlist ; do
805         if [ "$ar" = "$arch" ]; then
806             PrintDefine "__MODULE_KERNEL_$ar" "1" ifn,def,end $file
807         else
808             PrintDefine "__MODULE_KERNEL_$ar" "" und $file      # undef
809         fi
810     done
811     echo "" >> $file
812
813     PrintDefine "" "" end $file
814
815     if [ %{debugspec} = 1 ] ; then
816         echo "Kernel Configuration File for Red Hat kernels:"
817         cat $file
818     fi
819 }
820
821 config_opts="--enable-redhat-buildsys \
822         %{?_with_bitmap_later:--enable-bitmap-later} \
823         %{?_with_bos_restricted:--enable-bos-restricted-mode} \
824         %{?_with_fast_restart:--enable-fast-restart} \
825         %{?_with_largefiles:--enable-largefile-fileserver} \
826         %{?_with_supergroups:--enable-supergroups} \
827         --enable-transarc-paths"
828
829 # Configure AFS
830
831 # If we're using Fedora kmods, work out which is the best kernel module to 
832 # use for the userland configuration step. If no variants have been specified,
833 # then use the standard kernel. If variants are specified, use the standard kernel
834 # if it's listed, otherwise pick the first listed kernel.
835 ksrc=""
836 %if %{fedorakmod} 
837   for kvariant in %{kvariants} ; do
838     if [ -z "${kvariant}" -o -z "$ksrc" ] ; then
839       if [ -d %{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} ] ; then
840         ksrc=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu}
841       else
842         ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}
843       fi
844     fi
845   done
846 %endif
847 if [ -z "$ksrc" ] ; then
848 ksrc=%{ksrcdir}
849 fi
850
851 CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
852
853 ./configure --with-afs-sysname=${sysname} \
854        --prefix=%{_prefix} \
855        --libdir=%{_libdir} \
856        --bindir=%{_bindir} \
857        --sbindir=%{_sbindir} \
858        --disable-strip-binaries \
859 %if %{build_modules}
860        --with-linux-kernel-headers=${ksrc} \
861 %endif
862 %if %{krb5support}
863         --with-krb5-conf=%{krb5config} \
864 %endif
865        $config_opts \
866        || exit 1
867
868 # Build the libafs tree
869 make only_libafs_tree || exit 1
870
871 # Configure each of our kernel modules
872
873 %if %{fedorakmod} && %{build_modules}
874 for kvariant in %{kvariants} ; do
875   if [ -n "${kvariant}" ] ; then
876     if [ -d %{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} ] ; then
877       ksrc=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu}
878     else
879       ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}
880     fi
881
882     cp -R libafs_tree _kmod_build_${kvariant}
883     pushd _kmod_build_${kvariant}
884     ./configure --with-afs-sysname=${sysname} \
885         --prefix=%{_prefix} \
886         --libdir=%{_libdir} \
887         --bindir=%{_bindir} \
888         --sbindir=%{_sbindir} \
889         --with-linux-kernel-headers=${ksrc} \
890 %if %{krb5support}
891         --with-krb5-conf=/usr/kerberos/bin/krb5-config \
892 %endif
893         $config_opts \
894         || exit 1
895     popd
896   fi
897 done
898 %endif
899
900 %if %{build_userspace}
901 # Build the user-space AFS stuff
902 make dest_nolibafs || exit 1
903 %endif
904
905 %if %{build_modules}
906 %if %{fedorakmod}
907 for kvariant in %{kvariants}
908 do
909   if [ -n "${kvariant}" ] ; then
910     pushd _kmod_build_$kvariant;
911     make all MPS=SP
912     popd
913   else
914     make dest_only_libafs MPS=SP
915   fi
916 done
917
918 %else
919 # Begin legacy kernel module building code
920
921 %if %{kvers_is_24}
922 # Build all the kernel modules for linux 2.4.x
923 for variation in %{kvariations}
924 do
925     if [ ${variation} = up ]
926     then
927        local_smp_def=-DREDHAT_FIX
928        suffix=
929     else
930        local_smp_def="-DAFS_SMP -DREDHAT_FIX"
931        suffix=${variation}
932     fi
933
934     PrintRedhatKernelFix %{_target_cpu} $variation src/config/redhat-fix.h
935     make dest_only_libafs LOCAL_SMP_DEF="${local_smp_def}" \
936         LINUX_MODULE_NAME="${suffix}" MPS=SP
937
938 done
939 rm -f src/config/redhat-fix.h
940
941 %elseif %{kvers_is_26}
942 # Build the kernel module for this version of linux 2.6.x
943 # Notice how much easier this is than 2.4.  On the other hand,
944 # we require much more external support to build multiple modules.
945
946   # the MPS=SP just means that we don't add a '.mp' to the name.
947   make dest_only_libafs MPS=SP
948
949 %endif
950 # End legacy kernel module building code
951 %endif
952 %endif
953
954
955 ##############################################################################
956 #
957 # installation
958 #
959 ##############################################################################
960 %install
961
962 export DONT_GPRINTIFY=1
963
964 [ $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT
965
966 case %{kernvers} in
967    2.4.*)
968        kv='24'
969        kmodend=.o
970        ;;
971    2.6.*)
972        kv='26'
973        kmodend=.ko
974        ;;
975    *)
976        echo "I don't know how to build linux-`expr ${kernvers} : \(^[0-9]*[.][0-9]*\)`"
977        exit 1
978        ;;
979 esac
980
981 case %{_arch} in
982        x86_64)                         sysname=amd64_linux${kv}        ;;
983        alpha*)                         sysname=alpha_linux_${kv}       ;;
984        i386|i486|i586|i686|athlon)     sysname=i386_linux${kv}         ;;
985        *)                              sysname=%{_arch}_linux${kv}     ;;
986 esac
987
988 # Build install tree
989 %if %{build_userspace}
990 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
991 mkdir -p $RPM_BUILD_ROOT%{_libdir}
992 mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
993 mkdir -p $RPM_BUILD_ROOT%{initdir}
994 mkdir -p $RPM_BUILD_ROOT/etc/openafs
995 mkdir -p $RPM_BUILD_ROOT%{pamdir}
996 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/etc
997 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/logs
998 mkdir -p $RPM_BUILD_ROOT%{_prefix}/vice/etc
999 mkdir -p $RPM_BUILD_ROOT%{_prefix}/vice/cache
1000 chmod 700 $RPM_BUILD_ROOT%{_prefix}/vice/cache
1001 mkdir -p $RPM_BUILD_ROOT%{_mandir}
1002
1003 # Copy files from dest to the appropriate places in BuildRoot
1004 tar cf - -C ${sysname}/dest bin include | tar xf - -C $RPM_BUILD_ROOT%{_prefix}
1005 tar cf - -C ${sysname}/dest/lib . | tar xf - -C $RPM_BUILD_ROOT%{_libdir}
1006 tar cf - -C ${sysname}/dest/etc . | tar xf - -C $RPM_BUILD_ROOT%{_sbindir}
1007 tar cf - -C ${sysname}/dest/root.server%{_prefix}/afs bin | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/afs
1008 tar cf - -C ${sysname}/dest/root.client%{_prefix}/vice/etc afsd | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/vice/etc
1009
1010 # Link kpasswd to kapasswd
1011 ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
1012
1013 # Copy root.client config files
1014 install -m 755 src/packaging/RedHat/openafs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openafs
1015 install -m 755 src/packaging/RedHat/openafs-client.init $RPM_BUILD_ROOT%{initdir}/openafs-client
1016 install -m 755 src/packaging/RedHat/openafs-server.init $RPM_BUILD_ROOT%{initdir}/openafs-server
1017
1018 # Copy PAM modules
1019 install -m 755 ${sysname}/dest/lib/pam* $RPM_BUILD_ROOT%{pamdir}
1020
1021 # PAM symlinks
1022 ln -sf pam_afs.so.1 $RPM_BUILD_ROOT%{pamdir}/pam_afs.so
1023 ln -sf pam_afs.krb.so.1 $RPM_BUILD_ROOT%{pamdir}/pam_afs.krb.so
1024
1025 # Populate /usr/vice/etc
1026 uve=$RPM_BUILD_ROOT%{_prefix}/vice/etc
1027 install -p -m 644 src/packaging/RedHat/openafs-ThisCell $uve/ThisCell
1028 install -p -m 644 %{SOURCE20} $uve/CellServDB.dist
1029 install -p -m 644 src/packaging/RedHat/openafs-cacheinfo $uve/cacheinfo
1030
1031 #
1032 # install dkms source
1033 #
1034 install -d -m 755 $RPM_BUILD_ROOT%{_prefix}/src
1035 cp -a libafs_tree $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}
1036
1037 cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<EOF
1038
1039 PACKAGE_VERSION="%{dkms_version}"
1040
1041 # Items below here should not have to change with each driver version
1042 PACKAGE_NAME="%{name}"
1043 MAKE[0]="SMP=SP; eval \\\`grep CONFIG_SMP /boot/config-\${kernelver_array[0]}\\\`; [ -n \"\\\$CONFIG_SMP\" ] && SMP=MP; ./configure --with-linux-kernel-headers=\${kernel_source_dir}; make MPS=\\\$SMP; mv src/libafs/MODLOAD-*/openafs.ko ."
1044 CLEAN="make -C src/libafs clean"
1045
1046 BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
1047 DEST_MODULE_LOCATION[0]="/kernel/3rdparty/\$PACKAGE_NAME/"
1048
1049 AUTOINSTALL=yes
1050
1051 EOF
1052
1053 #
1054 # install kernel-source
1055 #
1056
1057 # Install the kernel module source tree
1058 mkdir -p $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/src
1059 tar cf - -C libafs_tree . | \
1060         tar xf - -C $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/src
1061
1062 # Next, copy the LICENSE Files, README
1063 install -m 644 src/LICENSE $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.IBM
1064 install -m 644 src/packaging/RedHat/openafs-LICENSE.Sun $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.Sun
1065 install -m 644 src/packaging/RedHat/openafs-README $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/README
1066
1067 #
1068 # Install DOCUMENTATION
1069 #
1070
1071 # Build the DOC directory
1072 mkdir -p $RPM_BUILD_ROOT/$RPM_DOC_DIR/openafs-%{afsvers}
1073 tar cf - -C doc LICENSE html pdf | \
1074     tar xf - -C $RPM_BUILD_ROOT/$RPM_DOC_DIR/openafs-%{afsvers}
1075 install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/$RPM_DOC_DIR/openafs-%{afsvers}
1076 install -m 644 %{SOURCE11} $RPM_BUILD_ROOT/$RPM_DOC_DIR/openafs-%{afsvers}
1077
1078 #
1079 # man pages
1080 #
1081 tar cf - -C doc/man-pages man1 man5 man8 | \
1082     tar xf - -C $RPM_BUILD_ROOT%{_mandir}
1083
1084 # Copy the uninstalled krb5 files (or delete the unused krb5 files)
1085 %if %{krb5support}
1086 mv $RPM_BUILD_ROOT%{_prefix}/afs/bin/asetkey $RPM_BUILD_ROOT%{_sbindir}/asetkey
1087 %else
1088 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/asetkey.*
1089 %endif
1090
1091 # remove unused man pages
1092 for x in afs_ftpd afs_inetd afs_login afs_rcp afs_rlogind afs_rsh \
1093     dkload knfs package runntp symlink symlink_list symlink_make \
1094     symlink_remove; do
1095         rm -f $RPM_BUILD_ROOT%{_mandir}/man1/${x}.1
1096 done
1097
1098 # rename kpasswd to kapasswd
1099 mv $RPM_BUILD_ROOT%{_mandir}/man1/kpasswd.1 $RPM_BUILD_ROOT%{_mandir}/man1/kapasswd.1
1100
1101 # gzip man pages
1102 gzip -9 $RPM_BUILD_ROOT%{_mandir}/man*/*
1103
1104 # create list of man pages that go in the 'openafs' package
1105 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man1 \
1106         |egrep '^afs|^fs|^kas|^klog|kapasswd|pagsh|^pts|^rxdebug|scout|^sys|tokens|translate|udebug|unlog|^uss|^vos' \
1107         >openafs-man1files
1108
1109 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man5 \
1110         |egrep 'CellServDB|ThisCell|afsmonitor|^butc|^uss' \
1111         >openafs-man5files
1112
1113 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man8 \
1114         |egrep '^backup|^bos|^butc|^fms|^fstrace|^kas|^read_tape|^uss' \
1115         >openafs-man8files
1116
1117 #
1118 # create filelist
1119 #
1120 grep -v "^#" >openafs-file-list <<EOF-openafs-file-list
1121 %{_bindir}/afsmonitor
1122 %{_bindir}/bos
1123 %{_bindir}/fs
1124 %{_bindir}/kapasswd
1125 %{_bindir}/kpasswd
1126 %{_bindir}/klog
1127 %{_bindir}/klog.krb
1128 %{_bindir}/pagsh
1129 %{_bindir}/pagsh.krb
1130 %{_bindir}/pts
1131 %{_bindir}/scout
1132 %{_bindir}/sys
1133 %{_bindir}/tokens
1134 %{_bindir}/tokens.krb
1135 %{_bindir}/translate_et
1136 %{_bindir}/udebug
1137 %{_bindir}/unlog
1138 %{_sbindir}/backup
1139 %{_sbindir}/butc
1140 %{_sbindir}/copyauth
1141 %{_sbindir}/fms
1142 %{_sbindir}/fstrace
1143 %{_sbindir}/kas
1144 %{_sbindir}/read_tape
1145 %{_sbindir}/restorevol
1146 %{_sbindir}/rxdebug
1147 %{_sbindir}/uss
1148 %{_sbindir}/vos
1149 %{_sbindir}/vsys
1150 EOF-openafs-file-list
1151
1152 # add man pages to the list
1153 cat openafs-man1files \
1154         | ( while read x; do echo "%{_mandir}/man1/$x"; done ) \
1155         >>openafs-file-list
1156 cat openafs-man5files \
1157         | ( while read x; do echo "%{_mandir}/man5/$x"; done ) \
1158         >>openafs-file-list
1159 cat openafs-man8files \
1160         | ( while read x; do echo "%{_mandir}/man8/$x"; done ) \
1161         >>openafs-file-list
1162
1163 #
1164 # Install compatiblity links
1165 #
1166 for d in bin:bin etc:sbin; do
1167   olddir=`echo $d | sed 's/:.*$//'`
1168   newdir=`echo $d | sed 's/^.*://'`
1169   mkdir -p $RPM_BUILD_ROOT%{_prefix}/afsws/$olddir
1170   for f in `cat openafs-file-list`; do
1171     if echo $f | grep -q /$newdir/; then
1172       fb=`basename $f`
1173       ln -sf %{_prefix}/$newdir/$fb $RPM_BUILD_ROOT%{_prefix}/afsws/$olddir/$fb
1174     fi
1175   done
1176 done
1177
1178 #
1179 # Remove files we're not installing
1180 #
1181
1182 # remove duplicated files from /usr/afs/bin
1183 for f in bos fs kas klog klog.krb kpwvalid pts tokens tokens.krb udebug vos ; do
1184   rm -f $RPM_BUILD_ROOT%{_prefix}/afs/bin/$f
1185 done
1186
1187 # compile_et is duplicated in e2fsprogs
1188 # the rest are not needed.
1189 for f in compile_et dlog dpass install knfs livesys xstat_cm_test xstat_fs_test ; do
1190   rm -f $RPM_BUILD_ROOT%{_bindir}/$f
1191 done
1192
1193 # not supported on Linux or duplicated
1194 for f in kdb rmtsysd kpwvalid ; do
1195   rm -f $RPM_BUILD_ROOT%{_sbindir}/$f
1196 done
1197 # sometimes install sucks and puts down a directory. kill it all.
1198 rm -rf $RPM_BUILD_ROOT%{_sbindir}/kdump*
1199
1200 # remove man pages from programs deleted above
1201 for f in 1/dlog 1/dpass 1/livesys 1/xstat_cm_test 1/xstat_fs_test 8/kdb 8/kpwvalid 8/xfs_size_check 1/package_test 5/package 8/package ; do
1202   rm -f $RPM_BUILD_ROOT%{_mandir}/man$f.*
1203 done
1204
1205 # PAM modules are doubly-installed  Remove the version we don't need
1206 for f in pam_afs.krb.so.1 pam_afs.so.1 ; do
1207   rm -f $RPM_BUILD_ROOT%{_libdir}/$f
1208 done
1209
1210 %if !%{build_authlibs}
1211 rm -f $RPM_BUILD_ROOT%{_libdir}/libafsauthent.so
1212 rm -f $RPM_BUILD_ROOT%{_libdir}/libafsrpc.so
1213 rm -f $RPM_BUILD_ROOT%{_libdir}/libafsauthent.so.*
1214 rm -f $RPM_BUILD_ROOT%{_libdir}/libafsrpc.so.*
1215 %endif
1216
1217 %endif
1218
1219 %if %{build_modules}
1220 %if %{fedorakmod}
1221 for kvariant in %{kvariants}
1222 do
1223   if [ -n "$kvariant" ] ; then
1224     if [ -d _kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}${kvariant}-SP ] ; then
1225       srcdir=_kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}${kvariant}-SP
1226     else
1227       srcdir=_kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}.%{_target_cpu}.${kvariant}-SP
1228     fi
1229   else
1230     srcdir=${sysname}/dest/root.client%{_prefix}/vice/etc/modload
1231   fi
1232
1233   if [ -f ${srcdir}/libafs-%{kverrel}${kvariant}.ko ] ; then
1234     srcmod=${srcdir}/libafs-%{kverrel}${kvariant}.ko
1235     dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}${kvariant}/extra/openafs
1236   else
1237     srcmod=${srcdir}/libafs-%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}.ko
1238     dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}/extra/openafs
1239   fi
1240
1241   mkdir -p ${dstdir}
1242   install -m 755 ${srcmod} ${dstdir}/openafs.ko
1243 done
1244 %else
1245 # Install the kernel modules
1246 for variation in %{kvariations}
1247 do
1248     if [ ${variation} = up ]
1249     then
1250        kvar=%{kxmoddir}
1251        modname=libafs-%{kernvers}${kmodend}
1252     else
1253        kvar=%{kxmoddir}${variation}
1254        modname=libafs-%{kernvers}${variation}${kmodend}
1255     fi
1256
1257     srcdir=${sysname}/dest/root.client%{_prefix}/vice/etc/modload
1258     dstdir=$RPM_BUILD_ROOT${kvar}/fs/openafs
1259
1260     mkdir -p ${dstdir}
1261
1262     install -m 755 ${srcdir}/${modname} ${dstdir}/openafs${kmodend}
1263 done
1264 %endif
1265 %endif
1266
1267 ##############################################################################
1268 ###
1269 ### clean
1270 ###
1271 ##############################################################################
1272 %clean
1273 rm -f openafs-file-list
1274 [ "$RPM_BUILD_ROOT" != "/" -a "x%{debugspec}" != "x1" ] && \
1275         rm -fr $RPM_BUILD_ROOT
1276
1277
1278 ##############################################################################
1279 ###
1280 ### scripts
1281 ###
1282 ##############################################################################
1283 %if %{build_userspace}
1284
1285 %pre compat
1286 if [ -e %{_prefix}/afsws ]; then
1287         /bin/rm -fr %{_prefix}/afsws
1288 fi
1289
1290 %post client
1291 chkconfig --add openafs-client
1292 if [ ! -d /afs ]; then
1293         mkdir /afs
1294         chown root.root /afs
1295         chmod 0755 /afs
1296 fi
1297
1298 # Create the CellServDB
1299 [ -f /usr/vice/etc/CellServDB.local ] || touch /usr/vice/etc/CellServDB.local
1300
1301 ( cd /usr/vice/etc ; \
1302   cat CellServDB.local CellServDB.dist > CellServDB ; \
1303   chmod 644 CellServDB )
1304
1305 echo
1306 echo The AFS cache is configured for 100 MB. Edit the
1307 echo /usr/vice/etc/cacheinfo file to change this before
1308 echo running AFS for the first time. You should also
1309 echo set your home cell in /usr/vice/etc/ThisCell.
1310 echo
1311 echo Also, you may want to edit /etc/pam.d/login and
1312 echo possibly others there to get an AFS token on login.
1313 echo Put the line:
1314 echo 
1315 echo    auth       sufficient   %{pamdir}/pam_afs.so try_first_pass ignore_root
1316 echo
1317 echo before the one for pwdb.
1318 echo
1319
1320 %post server
1321 chkconfig --add openafs-server
1322 %{initdir}/openafs-server condrestart
1323
1324 %if %{build_authlibs}
1325 %post authlibs
1326 /sbin/ldconfig
1327
1328 %postun authlibs
1329 /sbin/ldconfig
1330 %endif
1331
1332 %preun
1333 if [ $1 = 0 ] ; then
1334         [ -d /afs ] && rmdir /afs
1335 fi
1336
1337 %preun client
1338 if [ $1 = 0 ] ; then
1339         %{initdir}/openafs-client stop
1340         chkconfig --del openafs-client
1341 fi
1342
1343 %preun server
1344 if [ $1 = 0 ] ; then
1345         %{initdir}/openafs-server stop
1346         chkconfig --del openafs-server
1347 fi
1348
1349 %if %{build_dkmspkg}
1350 %post -n dkms-%{name}
1351 dkms add -m %{name} -v %{dkms_version} --rpm_safe_upgrade
1352 dkms build -m %{name} -v %{dkms_version} --rpm_safe_upgrade
1353 dkms install -m %{name} -v %{dkms_version} --rpm_safe_upgrade
1354
1355 %preun -n dkms-%{name}
1356 dkms remove -m %{namee} -v %{dkms_version} --rpm_safe_upgrade --all ||:
1357 %endif
1358 %endif
1359
1360 %if %{build_modules}
1361 %if !%{fedorakmod}
1362 %if %{up_package}
1363 %post kernel
1364 /sbin/depmod -ae %{kernvers}
1365
1366 %postun kernel
1367 /sbin/depmod -ae %{kernvers}
1368
1369 %endif
1370
1371 %if %{smp_package}
1372 %post kernel-smp
1373 /sbin/depmod -ae %{kernvers}%{?smp_ext:%{smp_ext}}
1374
1375 %postun kernel-smp
1376 /sbin/depmod -ae %{kernvers}%{?smp_ext:%{smp_ext}}
1377 %endif
1378
1379 %if %{largesmp_package}
1380 %post kernel-largesmp
1381 /sbin/depmod -ae %{kernvers}%{?largesmp_ext:%{largesmp_ext}}
1382
1383 %postun kernel-largesmp
1384 /sbin/depmod -ae %{kernvers}%{?largesmp_ext:%{largesmp_ext}}
1385 %endif
1386  
1387 %if %{bigmem_package}
1388 %post kernel-bigmem
1389 /sbin/depmod -ae %{kernvers}%{?bigmem_ext:%{bigmem_ext}}
1390
1391 %postun kernel-bigmem
1392 /sbin/depmod -ae %{kernvers}%{?bigmem_ext:%{bigmem_ext}}
1393 %endif
1394
1395 %if %{hugemem_package}
1396 %post kernel-hugemem
1397 /sbin/depmod -ae %{kernvers}%{?hugemem_ext:%{hugemem_ext}}
1398
1399 %postun kernel-hugemem
1400 /sbin/depmod -ae %{kernvers}%{?hugemem_ext:%{hugemem_ext}}
1401 %endif
1402 %endif
1403 %endif
1404
1405 ##############################################################################
1406 ###
1407 ### file lists
1408 ###
1409 ##############################################################################
1410 %if %{build_userspace}
1411
1412 %files -f openafs-file-list
1413 %defattr(-,root,root)
1414 %config /etc/sysconfig/openafs
1415 %doc %{_docdir}/openafs-%{afsvers}/LICENSE
1416
1417 %files docs
1418 %defattr(-,root,root)
1419 %doc %{_docdir}/openafs-%{afsvers}
1420
1421 %files client
1422 %defattr(-,root,root)
1423 %dir %{_prefix}/vice
1424 %dir %{_prefix}/vice/cache
1425 %dir %{_prefix}/vice/etc
1426 %{_prefix}/vice/etc/CellServDB.dist
1427 %config %{_prefix}/vice/etc/ThisCell
1428 %config %{_prefix}/vice/etc/cacheinfo
1429 %{_bindir}/cmdebug
1430 %{_bindir}/up
1431 %{_prefix}/vice/etc/afsd
1432 %{pamdir}/pam_afs.krb.so.1
1433 %{pamdir}/pam_afs.krb.so
1434 %{pamdir}/pam_afs.so.1
1435 %{pamdir}/pam_afs.so
1436 %{initdir}/openafs-client
1437 %{_mandir}/man1/cmdebug.*
1438 %{_mandir}/man1/up.*
1439 %{_mandir}/man5/afs*
1440 %{_mandir}/man5/cacheinfo.*
1441 %{_mandir}/man8/afsd.*
1442 %{_mandir}/man5/CellAlias.*
1443
1444 %files server
1445 %defattr(-,root,root)
1446 %dir %{_prefix}/afs
1447 %dir %{_prefix}/afs/bin
1448 %dir %{_prefix}/afs/etc
1449 %dir %{_prefix}/afs/logs
1450 %{_prefix}/afs/bin/bosserver
1451 %{_prefix}/afs/bin/bos_util
1452 %{_prefix}/afs/bin/buserver
1453 %{_prefix}/afs/bin/fileserver
1454 # Should we support KAServer?
1455 %{_prefix}/afs/bin/kaserver
1456 %{_prefix}/afs/bin/ka-forwarder
1457 %{_prefix}/afs/bin/pt_util
1458 %{_prefix}/afs/bin/ptserver
1459 %{_prefix}/afs/bin/salvager
1460 %{_prefix}/afs/bin/upclient
1461 %{_prefix}/afs/bin/upserver
1462 %{_prefix}/afs/bin/vlserver
1463 %{_prefix}/afs/bin/volinfo
1464 %{_prefix}/afs/bin/volserver
1465 %{_sbindir}/kadb_check
1466 %{_sbindir}/prdb_check
1467 %{_sbindir}/vldb_check
1468 %{_sbindir}/vldb_convert
1469 %{_sbindir}/voldump
1470 %{initdir}/openafs-server
1471 %{_mandir}/man5/AuthLog.*
1472 %{_mandir}/man5/BackupLog.*
1473 %{_mandir}/man5/BosConfig.*
1474 %{_mandir}/man5/BosLog.*
1475 %{_mandir}/man5/FORCESALVAGE.*
1476 %{_mandir}/man5/FileLog.*
1477 %{_mandir}/man5/KeyFile.*
1478 %{_mandir}/man5/NetInfo.*
1479 %{_mandir}/man5/NetRestrict.*
1480 %{_mandir}/man5/NoAuth.*
1481 %{_mandir}/man5/SALVAGE.fs.*
1482 %{_mandir}/man5/SalvageLog.*
1483 %{_mandir}/man5/sysid.*
1484 %{_mandir}/man5/UserList.*
1485 %{_mandir}/man5/VLLog.*
1486 %{_mandir}/man5/VolserLog.*
1487 %{_mandir}/man5/bdb.DB0.*
1488 %{_mandir}/man5/fms.log.*
1489 %{_mandir}/man5/kaserver.DB0.*
1490 %{_mandir}/man5/kaserverauxdb.*
1491 %{_mandir}/man5/prdb.DB0.*
1492 %{_mandir}/man5/salvage.lock.*
1493 %{_mandir}/man5/tapeconfig.*
1494 %{_mandir}/man5/vldb.DB0.*
1495 %{_mandir}/man8/buserver.*
1496 %{_mandir}/man8/fileserver.*
1497 %{_mandir}/man8/kadb_check.*
1498 %{_mandir}/man8/ka-forwarder.*
1499 %{_mandir}/man8/prdb_check.*
1500 %{_mandir}/man8/ptserver.*
1501 %{_mandir}/man8/pt_util.*
1502 %{_mandir}/man8/salvager.*
1503 %{_mandir}/man8/upclient.*
1504 %{_mandir}/man8/upserver.*
1505 %{_mandir}/man8/vldb_check.*
1506 %{_mandir}/man8/vldb_convert.*
1507 %{_mandir}/man8/vlserver.*
1508 %{_mandir}/man8/voldump.*
1509 %{_mandir}/man8/volinfo.*
1510 %{_mandir}/man8/volserver.*
1511
1512 %if %{build_authlibs}
1513 %files authlibs
1514 %defattr(-,root,root)
1515 %{_libdir}/libafsauthent.so.*
1516 %{_libdir}/libafsrpc.so.*
1517 %endif
1518
1519 %files authlibs-devel
1520 %defattr(-,root,root)
1521 %{_libdir}/libafsauthent.a
1522 %{_libdir}/libafsrpc.a
1523 %if %{build_authlibs}
1524 %{_libdir}/libafsauthent.so
1525 %{_libdir}/libafsrpc.so
1526 %endif
1527
1528 %files devel
1529 %defattr(-,root,root)
1530 %{_bindir}/rxgen
1531 %{_includedir}/afs
1532 %{_includedir}/des.h
1533 %{_includedir}/des_conf.h
1534 %{_includedir}/des_odd.h
1535 %{_includedir}/des_prototypes.h
1536 %{_includedir}/lock.h
1537 %{_includedir}/lwp.h
1538 %{_includedir}/mit-cpyright.h
1539 %{_includedir}/potpourri.h
1540 %{_includedir}/preempt.h
1541 %{_includedir}/rx
1542 %{_includedir}/timer.h
1543 %{_includedir}/ubik.h
1544 %{_includedir}/ubik_int.h
1545 %{_libdir}/afs
1546 %{_libdir}/libdes.a
1547 %{_libdir}/liblwp.a
1548 %{_libdir}/librx.a
1549 %{_libdir}/librxkad.a
1550 %{_libdir}/librxstat.a
1551 %{_libdir}/libubik.a
1552 %{_mandir}/man1/rxgen.*
1553
1554 %if %{build_dkmspkg}
1555 %files -n dkms-%{name}
1556 %defattr(-,root,root)
1557 %{_prefix}/src/%{name}-%{dkms_version}
1558 %endif
1559
1560 %files kernel-source
1561 %defattr(-,root,root)
1562 %{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.IBM
1563 %{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.Sun
1564 %{_prefix}/src/openafs-kernel-%{afsvers}/README
1565 %{_prefix}/src/openafs-kernel-%{afsvers}/src
1566
1567 %files compat
1568 %defattr(-,root,root)
1569 %{_prefix}/afsws
1570
1571 %files kpasswd
1572 %defattr(-,root,root)
1573 %{_bindir}/kpasswd
1574 %{_bindir}/kpwvalid
1575
1576 %if %{krb5support}
1577 %files krb5
1578 %defattr(-,root,root)
1579 %{_bindir}/aklog
1580 %{_bindir}/klog.krb5
1581 %{_sbindir}/asetkey
1582 %{_mandir}/man1/aklog.*
1583 %{_mandir}/man8/asetkey.*
1584 %endif
1585
1586 %endif
1587
1588 %if %{build_modules}
1589
1590 %if !%{fedorakmod}
1591 %if %{up_package}
1592 %files kernel
1593 %defattr(-,root,root)
1594 %{kxmoddir}/fs/openafs/openafs.*
1595 %endif
1596
1597 %if %{smp_package}
1598 %files kernel-smp
1599 %defattr(-,root,root)
1600 %{kxmoddir}%{?smp_ext:%{smp_ext}}/fs/openafs/openafs.*
1601 %endif
1602
1603 %if %{largesmp_package}
1604 %files kernel-largesmp
1605 %defattr(-,root,root)
1606 %{kxmoddir}%{?largesmp_ext:%{largesmp_ext}}/fs/openafs/openafs.*
1607 %endif
1608  
1609 %if %{bigmem_package}
1610 %files kernel-bigmem
1611 %defattr(-,root,root)
1612 %{kxmoddir}%{?bigmem_ext:%{bigmem_ext}}/fs/openafs/openafs.*
1613 %endif
1614
1615 %if %{hugemem_package}
1616 %files kernel-hugemem
1617 %defattr(-,root,root)
1618 %{kxmoddir}%{?hugemem_ext:%{hugemem_ext}}/fs/openafs/openafs.*
1619 %endif
1620 %endif
1621
1622 %endif
1623
1624 ##############################################################################
1625 ###
1626 ### openafs.spec change log
1627 ###
1628 ##############################################################################
1629 %changelog
1630 * Wed Dec 12 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
1631 - Make the RPM mockable
1632
1633 * Tue Oct 29 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
1634 - Update to match the shipped 1.4.5 RPMS
1635 - Fix the kvariant stuff to only configure the 'standard' case once
1636 - Add openafs-kvers.sh back in
1637
1638 * Wed Oct 10 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5pre1-1
1639 - Use Fedora style kmods, which allows us to install multiple kernel types
1640
1641 * Thu Jun 07 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.4-3
1642 - Use distributed files, rather than those in packager's SOURCE directory
1643 - Remove SuidCells stuff, which was unused
1644
1645 * Fri Dec 01 2006  Derrick Brashear <shadow@dementia.org> 1.4.2-2
1646 - integrate s390x changes
1647 - allow for building libafs*.a and not libafs*.so into packages, for platforms
1648   that won't build the .so files.
1649
1650 * Wed Aug 23 2006  Derrick Brashear <shadow@dementia.org> 1.4.2-1
1651 - update to 1.4.2
1652 - use installed aklog manpage.
1653 - moduleparam patch obsoleted.
1654
1655 * Tue Aug 22 2006  Derek Atkins <warlord@MIT.EDU> 1.4.2-0.1.rc1
1656 - update to 1.4.2-rc1
1657 - hand-apply lee damon's changes to support largesmp kernels from RHEL4
1658   (but only add support for 2.6 kernels.  No need for the 2.4 kernels).
1659 - don't need the posixlock patch anymore.
1660
1661 * Wed Jul 12 2006  Derek Atkins <warlord@MIT.EDU> 1.4.2-0.beta2
1662 - update to 1.4.2-beta2
1663 - add linux2.4 posixlock API patch
1664
1665 * Mon Jun 26 2006  Derek Atkins <warlord@MIT.EDU>
1666 - moduleparam and krb524 patches no longer required in OA-CVS
1667
1668 * Wed May 17 2006  Derek Atkins <warlord@MIT.EDU>
1669 - change non-target-cpu kernel dep to a file dep
1670 - make sure we use the proper kernel version for the dependency.
1671
1672 * Tue May 16 2006  Derek Atkins <warlord@MIT.EDU>
1673 - allow users to specify local CellServDB and SuidCells entries
1674   don't overwrite user's changes.  Provide a .dist an let users
1675   make entries in a ".local"
1676 - build the CellServDB and SuidCells at client startup and at
1677   client install-time
1678 - add provideskernelarch functionality to openafs-kvers-is.sh
1679 - use that functionality to Require kernel{,-<type>}-targetcpu
1680   to get better package safety due to RPM bugs where the kernel
1681   release isn't used so you can install the kernel module against
1682   any kernel of the same major version.
1683
1684 * Mon May 15 2006  Derek Atkins <warlord@MIT.EDU>
1685 - update the README in openafs-kernel-source
1686 - fix openafs-kvers-is.sh from Alexander Bergolth's patch.
1687 - move kernel module from .../kernel/fs/openafs to .../fs/openafs/
1688
1689 * Fri Apr 21 2006  Derek Atkins <warlord@MIT.EDU>
1690 - build requires autoconf and automake for krb5support
1691   and autoconf for standard package
1692 - dont setup the krb5 migration kit (or patches) if we don't care.
1693 - require ncurses-devel to build
1694
1695 * Wed Apr 19 2006  Derek Atkins <warlord@MIT.EDU> 1.4.1-3
1696 - look for krb524 functions in libkrb524 if we can't find them
1697   in the standard locations.
1698
1699 * Tue Apr 18 2006  Derek Atkins <warlord@MIT.EDU> 1.4.1-2
1700 - fix the module_param_array macro for Linux 2.6.9.
1701
1702 * Sat Apr 15 2006  Derek Atkins <warlord@MIT.EDU> 1.4.1-1
1703 - update to 1.4.1 release.
1704 - distribute asetkey from openafs instead of krb5-migration kit
1705 - don't need to apply the FC5 patches because they are part of the distro.
1706 - install asetkey into the "proper" place
1707 - dont list a manpage twice.
1708 - package asetkey man page.  delete it when not needed.
1709
1710 * Thu Apr  6 2006  Derek Atkins <warlord@MIT.EDU>
1711 - turn authlibs back on, because RT #18767 was applied to CVS.
1712
1713 * Wed Mar 29 2006  Derek Atkins <warlord@MIT.EDU> 1.4.1rc10-1
1714 - update to 1.4.1rc10, build on FC5
1715 - fix the man pages (distribute into various packages)
1716 - include patches for FC5, RT #29112 and #29122
1717
1718 * Mon Dec 19 2005  Derek Atkins <warlord@MIT.EDU>
1719 - openafs-server shouldn't depend on the kernel module.
1720
1721 * Thu Nov 17 2005  Derek Atkins <warlord@MIT.EDU>
1722 - patch from Mike Polek <mike at pictage.com> to run depmod for
1723   the target kernel and not the running kernel.
1724
1725 * Tue Nov  8 2005  Derek Atkins <warlord@MIT.EDU>
1726 - build aklog from the openafs sources, not from the krb5 migration kit.
1727
1728 * Fri Nov  4 2005  Derek Atkins <warlord@MIT.EDU>
1729 - set openafs-kernel-source to Provide openafs-kernel
1730
1731 * Thu Oct 20 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0-1
1732 - update afs-krb5 res_search patch: look for res_search and __res_search
1733 - update to 1.4.0 final
1734
1735 * Mon Oct 10 2005  Derek Atkins <warlord@MIT.EDU>
1736 - remove all kdump builds.
1737
1738 * Thu Oct  6 2005  Derek Atkins <warlord@MIT.EDU>
1739 - fix openafs-kernel-version.sh so it will build an RPM for the
1740   currently-running kernel even if it's smp on 2.6.
1741
1742 * Tue Sep 27 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0rc5-1
1743 - upgrade to 1.4.0rc5
1744 - turn off authlibs packages
1745
1746 * Fri Sep 23 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0rc4-2
1747 - add kmodule26 patch: fix the kernel module name on 2.6 kernels so
1748   it's called "openafs" and not "libafs".  This fixes the shutdown
1749   problem.
1750
1751 * Thu Sep 22 2005  Derek Atkins <warlord@MIT.EDU>
1752 - update kversis script, add 'kvers' operation
1753 - fix bug that 2.6 smp/hugemem kernels don't provide
1754   kernel-foo = %{kernvers} with 'smp', 'hugemem', etc.
1755 - add patch to remove res_search from the afs-krb5 configure
1756
1757 * Thu Sep 15 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0rc4-1
1758 - Update to 1.4.0rc4
1759 - Update the afs-krb5 krb524 patch so it actually works on
1760   some older systems like RHEL3 that still need -lkrb524.
1761 - Update the buildall script so choose better architecture support,
1762   e.g. don't build i586 on RHEL.
1763 - Update the rebuild information in the SPEC file.
1764 - Add support for finding .EL kernels in openafs-kvers-is.sh
1765 - Add additional error messages when kernel version/type parsing fails.
1766 - Update the buildall script to use the kernel srcdir directly.
1767
1768 * Wed Sep 14 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0rc3-2
1769 - Add "hugemem" to 2.4 configs
1770 - Add checks to support scripts to determine whether to build
1771   the bigmem and/or hugemem kernels for 2.4.
1772
1773 * Mon Sep 12 2005  Derek Atkins <warlord@MIT.EDU> 1.4.0rc3-1
1774 - Added some afs-krb5 patches to get the migration kit to build
1775   on modern AFS and modern Kerberos.
1776 - Added authlibs and authlibs-devel packages as per UMich changes.
1777
1778 * Sun Sep 11 2005  Derek Atkins <warlord@MIT.EDU>
1779 - Merged in some of the 2.6 changes from wingc@engin.umich.edu
1780
1781 * Sat Sep 10 2005  Derek Atkins <warlord@MIT.EDU>
1782 - Merged in lots of changes from David Howells and Nalin Dahyabhai
1783   from Red Hat.   Initial attempt at a release of 1.4.  Still need
1784   to work in a 2.6 build system.