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