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