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