RedHat: Fix specfile changelog
[openafs.git] / src / packaging / RedHat / openafs.spec.in
index c035d13..aa4c253 100644 (file)
@@ -1,19 +1,11 @@
 # Openafs Spec $Revision$
 
-# TEMPORARY fix for patch fuzz so we can build on Fedora 10
-%define _default_patch_fuzz 2
-
 %define afsvers @VERSION@
 %define pkgvers @LINUX_PKGVER@
-# for beta/rc releases make pkgrel 0.X.<tag>
+# for beta/rc releases make pkgrel 0.<tag>
 # for real releases make pkgrel 1 (or more for extra releases)
-#%define pkgrel 0.1.rc1
 %define pkgrel @LINUX_PKGREL@
 
-%if %{?osvers:0}%{!?osvers:1}
-%define osvers 1
-%endif
-
 %{!?fedorakmod: %define fedorakmod 1}
 %{!?build_dkmspkg: %define build_dkmspkg 1}
 
 %define build_modules_on_cmdline %{?build_modules:1}%{!?build_modules:0}
 %define build_authlibs_on_cmdline %{?build_authlibs:1}%{!?build_authlibs:0}
 
+%if 0%{?rhel} >= 5
+%define fedorakmod 1
+%endif
+%if 0%{?fedora}
+%define fedorakmod 1
+%endif
+
+%if !%{fedorakmod}
 # Determine the version of the kernel to build against
 # - automatically select running kernel if there are sources in /lib/modules
 # - note that this can be overridden on the command line
@@ -40,6 +40,7 @@
 %if %{kern24}
 %define fedorakmod 0
 %endif
+%endif
 
 %if %{fedorakmod}
 %define kmodtool bash %{_sourcedir}/openafs-kmodtool
@@ -90,7 +91,7 @@
 # End legacy kernel build stuff
 %endif 
 
-%define dkms_version %{osvers}.%{pkgrel}
+%define dkms_version %{pkgvers}-%{pkgrel}%{?dist}
 
 # Set 'debugspec' to 1 if you want to debug the spec file.  This will
 # not remove the installed tree as part of the %clean operation
 # to distribute aklog and asetkey
 %define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
 
-%if %{krb5support}
-%if %{?krb5config:0}%{!?krb5config:1}
-%define krb5config /usr/kerberos/bin/krb5-config
-%endif
-%endif
-
 # Set 'bootkernelsupport' to 1 if you want to build the
 # kernel module for Red Hat BOOT Kernels on x86.
 %define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
 
 # Define the location of your init.d directory
-%define initdir /etc/init.d
+%define initdir /etc/rc.d/init.d
 
 #determine if the kernel provides an arch-specific Provides
 %define kprovidesarch %(%{kversis} provideskernelarch %{ksrcdir} %{_target_cpu})
 # Define the location of the PAM security module directory
 %define pamdir /%{_lib}/security
 
+#######################################################################
+# You probably don't need to change anything beyond this line
+# NOTE: If you do, please email me!!!
+
+# Determine which elements of OpenAFS to build.  For non-x86 arches
+# (subject to the ExclusiveArch setting, below), we build both userspace
+# and modules.  For most x86 arches, we build just the kernel modules.  For
+# i386, we build just the userspace.  If you're running an i386 kernel,
+# you'll need to tweak that last bit.
+%if !%{build_userspace_on_cmdline} && !%{build_modules_on_cmdline}
+
+%define build_userspace 1
+%define build_modules 1
+%ifarch %{ix86} x86_64 ia64
+%define build_authlibs 1
+%else
+%define build_authlibs 0
+%endif
+
+%else
+%if !%{build_userspace_on_cmdline}
+%define build_userspace 0
+%endif
+%if !%{build_modules_on_cmdline}
+%define build_modules 0
+%endif
+%endif
+
+%if !%{build_authlibs_on_cmdline}
+%if %{build_userspace_on_cmdline}
+%define build_authlibs 1
+%else
+%define build_authlibs 0
+%endif
+%endif
+
+%if %{build_modules}
 %if !%{fedorakmod}
 
 # Define the set of kernel module variations to be built:
 
 # End of legacy kernel module build
 %endif 
-
-#######################################################################
-# You probably don't need to change anything beyond this line
-# NOTE: If you do, please email me!!!
-
-# Determine which elements of OpenAFS to build.  For non-x86 arches
-# (subject to the ExclusiveArch setting, below), we build both userspace
-# and modules.  For most x86 arches, we build just the kernel modules.  For
-# i386, we build just the userspace.  If you're running an i386 kernel,
-# you'll need to tweak that last bit.
-%if !%{build_userspace_on_cmdline} && !%{build_modules_on_cmdline}
-
-%ifarch x86_64 ia64 s390 s390x
-%define build_userspace 1
-%define build_modules 1
-%ifarch x86_64 ia64
-%define build_authlibs 1
-%else
-%define build_authlibs 0
-%endif
-%endif
-
-%ifarch %{ix86}
-%define build_userspace 0
-%define build_modules 1
-%define build_authlibs 1
-%endif
-
-%ifarch i386
-%define build_userspace 1
-%define build_modules 0
-%define build_authlibs 1
-%endif
-
-%endif
-
-# deal with cmdline specification
-%if %{build_userspace_on_cmdline} || %{build_modules_on_cmdline}
-%if !%{build_userspace_on_cmdline}
-%define build_userspace 0
-%endif
-%if !%{build_modules_on_cmdline}
-%define build_modules 0
-%endif
-%endif
-
-%if !%{build_authlibs_on_cmdline}
-%if %{build_userspace_on_cmdline}
-%define build_authlibs 1
-%else
-%define build_authlibs 0
-%endif
 %endif
 
 # Make sure RPM doesn't complain about installed but non-packaged files.
 Summary: OpenAFS distributed filesystem
 Name: openafs
 Version: %{pkgvers}
-Release: %{osvers}.%{pkgrel}
+Release: %{pkgrel}%{?dist}
 License: IBM Public License
 URL: http://www.openafs.org
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Packager: OpenAFS Gatekeepers <openafs-gatekeepers@openafs.org>
 Group: Networking/Filesystems
 BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel, flex, bison
+%if 0%{?fedora} >= 15
+BuildRequires: systemd-units perl-devel
+%endif
+%if 0%{?rhel} >= 6
+BuildRequires: perl-devel
+%endif
+BuildRequires: perl(ExtUtils::Embed)
 %if %{krb5support}
 BuildRequires: krb5-devel
 %endif
+%if %{build_modules}
+BuildRequires: kernel-devel
+%endif
+
 ExclusiveArch: %{ix86} x86_64 ia64 s390 s390x sparc64 ppc ppc64
 
 #    http://dl.openafs.org/dl/openafs/candidate/%{afsvers}/...
@@ -269,7 +260,7 @@ Source1: http://www.openafs.org/dl/openafs/%{afsvers}/openafs-%{afsvers}-doc.tar
 Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
 Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
 
-Source20: http://dl.central.org/dl/cellservdb/CellServDB.2010-02-28
+Source20: http://dl.central.org/dl/cellservdb/CellServDB.2013-01-28
 
 Source30: openafs-kernel-version.sh
 Source996: openafs-kvers-is.sh
@@ -301,8 +292,6 @@ what gets built:
  --without krb5                   Disable krb5 support (default: with krb5)
  --with bitmap-later              Enable "bitmap later" support
  --with bos-restricted            Enable "bos restricted" mode
- --with fast-restart              Enable "fast restart" mode
- --with largefiles                Enable "largefile fileserver" mode
  --with supergroups               Enable "supergroups"
 
  --target=i386                    The target architecture to build for.
@@ -331,7 +320,7 @@ what gets built:
                                   or kdump 
 
 To a kernel module for your running kernel, just run:
-  rpmbuild --rebuild --target=`uname -m` openafs-%{pkgvers}-%{osvers}.%{pkgrel}.src.rpm
+  rpmbuild --rebuild --target=`uname -m` openafs-%{pkgvers}-%{pkgrel}%{?dist}.src.rpm
 
 ##############################################################################
 #
@@ -341,7 +330,13 @@ To a kernel module for your running kernel, just run:
 %if %{build_userspace}
 
 %package client
-Requires: binutils, openafs = %{PACKAGE_VERSION}
+Requires: binutils, openafs = %{version}
+%if 0%{?fedora} >= 15
+Requires: systemd-units
+Requires(post): systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
 
 %if %{fedorakmod}
 Requires: %{name}-kmod >= %{version}
@@ -363,9 +358,15 @@ This package provides basic client support to mount and manipulate
 AFS.
 
 %package server
-Requires: openafs = %{PACKAGE_VERSION}
+Requires: openafs = %{version}
 Summary: OpenAFS Filesystem Server
 Group: Networking/Filesystems
+%if 0%{?fedora} >= 15
+Requires: systemd-units
+Requires(post): systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
 
 %description server
 The AFS distributed filesystem.  AFS is a distributed filesystem
@@ -380,9 +381,9 @@ Cell.
 %package -n dkms-%{name}
 Summary:        DKMS-ready kernel source for AFS distributed filesystem
 Group:          Development/Kernel
-Provides:       openafs-kernel = %{PACKAGE_VERSION}
+Provides:       openafs-kernel = %{version}
 %if %{fedorakmod}
-Provides: %{name}-kmod = %{PACKAGE_VERSION}
+Provides: %{name}-kmod = %{version}
 %endif
 Requires(pre):  dkms
 Requires(pre):  flex
@@ -418,9 +419,9 @@ authentication may link against them.
 
 %package authlibs-devel
 %if %{build_authlibs}
-Requires: openafs-authlibs = %{PACKAGE_VERSION}
+Requires: openafs-authlibs = %{version}-%{release}
 %endif
-Requires: openafs-devel = %{PACKAGE_VERSION}
+Requires: openafs-devel = %{version}-%{release}
 Summary: OpenAFS shared library development
 Group: Development/Filesystems
 
@@ -437,6 +438,7 @@ libraries.
 %package devel
 Summary: OpenAFS Development Libraries and Headers
 Group: Development/Filesystems
+Requires: openafs = %{version}-%{release}
 
 %description devel
 The AFS distributed filesystem.  AFS is a distributed filesystem
@@ -450,7 +452,7 @@ shared libraries.
 
 %package docs
 Summary: OpenAFS user and administrator documentation
-Requires: openafs = %{PACKAGE_VERSION}
+Requires: openafs = %{version}-%{release}
 Group: Networking/Filesystems
 
 %description docs
@@ -465,9 +467,9 @@ administrators.
 %package kernel-source
 Summary: OpenAFS Kernel Module source tree
 Group: Networking/Filesystems
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{fedorakmod}
-Provides: %{name}-kmod = %{PACKAGE_VERSION}
+Provides: %{name}-kmod = %{version}
 %endif
 
 %description kernel-source
@@ -481,7 +483,7 @@ module.
 
 %package compat
 Summary: OpenAFS client compatibility symlinks
-Requires: openafs = %{PACKAGE_VERSION}, openafs-client = %{PACKAGE_VERSION}
+Requires: openafs = %{version}, openafs-client = %{version}
 Group: Networking/Filesystems
 Obsoletes: openafs-client-compat
 
@@ -513,7 +515,7 @@ you are using KAserver instead of Krb5.
 %if %{krb5support}
 %package krb5
 Summary: OpenAFS programs to use with krb5
-Requires: openafs = %{PACKAGE_VERSION}
+Requires: openafs = %{version}
 Group: Networking/Filesystems
 BuildRequires: krb5-devel
 
@@ -552,7 +554,7 @@ krb4 lookalike services.
 Summary: OpenAFS Kernel Module (compiled for UP)
 Release: %{modpkgrel}
 Group: Networking/Filesystems
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{kprovidesarch}
 Requires: kernel-%{_target_cpu} = %{kversion}
 %else
@@ -572,7 +574,7 @@ This package provides a precompiled AFS kernel module for %{kernvers}.
 %package kernel-smp
 Summary: OpenAFS Kernel Module (compiled for SMP)
 Release: %{modpkgrel}
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{kprovidesarch}
 Requires: kernel-smp-%{_target_cpu} = %{kversion}
 %else
@@ -593,7 +595,7 @@ This package provides a precompiled AFS kernel module for %{kernvers}.
 %package kernel-largesmp
 Summary: OpenAFS Kernel Module (compiled for LARGESMP)
 Release: %{modpkgrel}
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{kprovidesarch}
 Requires: kernel-largesmp-%{_target_cpu} = %{kversion}
 %else
@@ -614,7 +616,7 @@ This package provides a precompiled AFS kernel module for %{kernvers}.
 %package kernel-bigmem
 Summary: OpenAFS Kernel Module (compiled for SMP & big memory support)
 Release: %{modpkgrel}
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{kprovidesarch}
 Requires: kernel-bigmem-%{_target_cpu} = %{kversion}
 %else
@@ -635,7 +637,7 @@ This package provides a precompiled AFS kernel module for %{kernvers}.
 %package kernel-hugemem
 Summary: OpenAFS Kernel Module (compiled for SMP & huge memory support)
 Release: %{modpkgrel}
-Provides: openafs-kernel = %{PACKAGE_VERSION}
+Provides: openafs-kernel = %{version}
 %if %{kprovidesarch}
 Requires: kernel-hugemem-%{_target_cpu} = %{kversion}
 %else
@@ -701,19 +703,22 @@ This package provides a precompiled AFS kernel module for %{kernvers}.
 #
 ##############################################################################
 %build
-
+%if !%{fedorakmod}
 case %{kernvers} in
    2.4.*)
        kv='24'
        ;;
-   2.6.*)
+   2.6.* | 3.*)
        kv='26'
        ;;
    *)
-       echo "I don't know how to build linux-`expr ${kernvers} : \(^[0-9]*[.][0-9]*\)`"
+       echo "I don't know how to build linux-`expr %{kernvers} : '\(^[0-9]*[.][0-9]*\)'`"
        exit 1
        ;;
 esac
+%else
+kv='26'
+%endif
 
 case %{_arch} in
        x86_64)                         sysname=amd64_linux${kv}        ;;
@@ -828,8 +833,6 @@ PrintRedhatKernelFix() {
 config_opts="--enable-redhat-buildsys \
        %{?_with_bitmap_later:--enable-bitmap-later} \
        %{?_with_bos_restricted:--enable-bos-restricted-mode} \
-       %{?_with_fast_restart:--enable-fast-restart} \
-       %{?_with_largefiles:--enable-largefile-fileserver} \
        %{?_with_supergroups:--enable-supergroups} \
        --enable-transarc-paths"
 
@@ -845,6 +848,8 @@ ksrc=""
     if [ -z "${kvariant}" -o -z "$ksrc" ] ; then
       if [ -d %{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} ] ; then
         ksrc=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu}
+      elif [ -d %{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:++$kvariant} ] ; then
+        ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:++$kvariant}
       else
         ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}
       fi
@@ -857,19 +862,26 @@ fi
 
 CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
 
+%if %{krb5support}
+%if %{?krb5config:1}%{!?krb5config:0}
+KRB5_CONFIG="%{krb5config}"
+export KRB5_CONFIG
+%endif
+%endif
+
 ./configure --with-afs-sysname=${sysname} \
        --prefix=%{_prefix} \
        --libdir=%{_libdir} \
        --bindir=%{_bindir} \
        --sbindir=%{_sbindir} \
        --disable-strip-binaries \
+       --enable-debug \
        --with-linux-kernel-packaging \
-       --enable-disconnected \
 %if %{build_modules}
        --with-linux-kernel-headers=${ksrc} \
 %endif
 %if %{krb5support}
-       --with-krb5-conf=%{krb5config} \
+       --with-krb5 \
 %endif
        $config_opts \
        || exit 1
@@ -882,8 +894,16 @@ make only_libafs_tree || exit 1
 %if %{fedorakmod} && %{build_modules}
 for kvariant in %{kvariants} ; do
   if [ -n "${kvariant}" ] ; then
+
     if [ -d %{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} ] ; then
       ksrc=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu}
+
+    elif [ -d %{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:++$kvariant} ] ; then
+      # Fedora 20 started putting kernel sources in e.g.
+      # 3.12.5-302.fc20.i686+PAE, instead of:
+      # 3.12.5-302.fc20.i686.PAE
+      ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:++$kvariant}
+
     else
       ksrc=%{_usrsrc}/kernels/%{kverrel}.%{_target_cpu}${kvariant:+.$kvariant}
     fi
@@ -973,21 +993,24 @@ rm -f src/config/redhat-fix.h
 export DONT_GPRINTIFY=1
 
 [ $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT
-
+%if !%{fedorakmod}
 case %{kernvers} in
    2.4.*)
        kv='24'
        kmodend=.o
        ;;
-   2.6.*)
+   2.6.* | 3.*)
        kv='26'
        kmodend=.ko
        ;;
    *)
-       echo "I don't know how to build linux-`expr ${kernvers} : \(^[0-9]*[.][0-9]*\)`"
+       echo "I don't know how to build linux-`expr %{kernvers} : '\(^[0-9]*[.][0-9]*\)'`"
        exit 1
        ;;
 esac
+%else
+kv='26'
+%endif
 
 case %{_arch} in
        x86_64)                         sysname=amd64_linux${kv}        ;;
@@ -1001,7 +1024,12 @@ esac
 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
 mkdir -p $RPM_BUILD_ROOT%{_libdir}
 mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
+%if 0%{?fedora} < 15
 mkdir -p $RPM_BUILD_ROOT%{initdir}
+%else
+mkdir -p $RPM_BUILD_ROOT%{_unitdir}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules
+%endif
 mkdir -p $RPM_BUILD_ROOT/etc/openafs
 mkdir -p $RPM_BUILD_ROOT%{pamdir}
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/etc
@@ -1018,7 +1046,12 @@ tar cf - -C ${sysname}/dest/etc . | tar xf - -C $RPM_BUILD_ROOT%{_sbindir}
 tar cf - -C ${sysname}/dest/root.server%{_prefix}/afs bin | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/afs
 tar cf - -C ${sysname}/dest/root.client%{_prefix}/vice/etc afsd C | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/vice/etc
 
-# Fix the location of restorevol
+# Set the executable bit on libraries in libdir, so rpmbuild knows to 
+# create "Provides" entries in the package metadata for the libraries
+chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so*
+
+# Fix the location of restorevol, since it should be available for
+# any user in /usr/bin
 mv $RPM_BUILD_ROOT%{_prefix}/afs/bin/restorevol $RPM_BUILD_ROOT%{_bindir}/restorevol
 
 # Link kpasswd to kapasswd
@@ -1026,8 +1059,14 @@ ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
 
 # Copy root.client config files
 install -m 755 src/packaging/RedHat/openafs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openafs
+%if 0%{?fedora} < 15
 install -m 755 src/packaging/RedHat/openafs-client.init $RPM_BUILD_ROOT%{initdir}/openafs-client
 install -m 755 src/packaging/RedHat/openafs-server.init $RPM_BUILD_ROOT%{initdir}/openafs-server
+%else
+install -m 755 src/packaging/RedHat/openafs-client.service $RPM_BUILD_ROOT%{_unitdir}/openafs-client.service
+install -m 755 src/packaging/RedHat/openafs-client.modules $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules/openafs-client.modules
+install -m 755 src/packaging/RedHat/openafs-server.service $RPM_BUILD_ROOT%{_unitdir}/openafs-server.service
+%endif
 
 # Copy PAM modules
 install -m 755 ${sysname}/dest/lib/pam* $RPM_BUILD_ROOT%{pamdir}
@@ -1048,17 +1087,17 @@ install -p -m 644 src/packaging/RedHat/openafs-cacheinfo $uve/cacheinfo
 install -d -m 755 $RPM_BUILD_ROOT%{_prefix}/src
 cp -a libafs_tree $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}
 
-cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<EOF
+cat > $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}/dkms.conf <<"EOF"
 
 PACKAGE_VERSION="%{dkms_version}"
 
 # Items below here should not have to change with each driver version
 PACKAGE_NAME="%{name}"
-MAKE[0]="SMP=SP; eval \\\`grep CONFIG_SMP /boot/config-\${kernelver_array[0]}\\\`; [ -n \"\\\$CONFIG_SMP\" ] && SMP=MP; KMODNAME=openafs.ko; DSTKMOD=\\".\\"; [ \\"\\\`echo \\"\${kernelver_array[0]}\\" | sed -e 's/^\\([0-9]*\\.[0-9]*\\)\\..*/\\1/'\\\`\\" = \\"2.4\\" ] && KMODNAME=\\"libafs-*\\" && DSTKMOD=openafs.o; ./configure --enable-disconnected --with-linux-kernel-headers=\${kernel_source_dir} --with-linux-kernel-packaging; make MPS=\\\$SMP; mv src/libafs/MODLOAD-*/\\\$KMODNAME \\\$DSTKMOD"
+MAKE[0]='./configure --with-linux-kernel-headers=${kernel_source_dir} --with-linux-kernel-packaging && make && case "${kernelver_array[0]}${kernelver[0]}" in 2.4.*) mv src/libafs/MODLOAD-*/libafs-* openafs.o ;; *) mv src/libafs/MODLOAD-*/openafs.ko . ;; esac'
 CLEAN="make -C src/libafs clean"
 
-BUILT_MODULE_NAME[0]="\$PACKAGE_NAME"
-DEST_MODULE_LOCATION[0]="/kernel/3rdparty/\$PACKAGE_NAME/"
+BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
+DEST_MODULE_LOCATION[0]="/kernel/3rdparty/$PACKAGE_NAME/"
 STRIP[0]=no
 AUTOINSTALL=yes
 
@@ -1117,7 +1156,8 @@ gzip -9 $RPM_BUILD_ROOT%{_mandir}/man*/*
 
 # create list of man pages that go in the 'openafs' package
 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man1 \
-       |egrep '^afs|^fs|^kas|^klog|kapasswd|pagsh|^pts|^restorevol|^rxdebug|scout|^sys|tokens|translate|udebug|unlog|^uss|^vos' \
+       |egrep '^afs|^fs|^kas|^klog|kapasswd|pagsh|^pts|^restorevol|^rxdebug|scout|^sys|tokens|translate|^xstat|udebug|unlog|^uss|^vos' \
+       |egrep -v '^afs_compile_et' \
        >openafs-man1files
 
 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man5 \
@@ -1125,7 +1165,7 @@ gzip -9 $RPM_BUILD_ROOT%{_mandir}/man*/*
        >openafs-man5files
 
 /bin/ls $RPM_BUILD_ROOT%{_mandir}/man8 \
-       |egrep '^backup|^bos|^butc|^fms|^fstrace|^kas|^read_tape|^uss' \
+       |egrep '^aklog_dynamic_auth|^backup|^bos|^butc|^fms|^fssync-debug|^fstrace|^kas|^read_tape|^uss' \
        >openafs-man8files
 
 #
@@ -1136,7 +1176,6 @@ grep -v "^#" >openafs-file-list <<EOF-openafs-file-list
 %{_bindir}/bos
 %{_bindir}/fs
 %{_bindir}/kapasswd
-%{_bindir}/kpasswd
 %{_bindir}/klog
 %{_bindir}/klog.krb
 %{_bindir}/pagsh
@@ -1148,6 +1187,8 @@ grep -v "^#" >openafs-file-list <<EOF-openafs-file-list
 %{_bindir}/tokens
 %{_bindir}/tokens.krb
 %{_bindir}/translate_et
+%{_bindir}/xstat_cm_test
+%{_bindir}/xstat_fs_test
 %{_bindir}/udebug
 %{_bindir}/unlog
 %{_sbindir}/backup
@@ -1198,7 +1239,7 @@ for f in bos fs kas klog klog.krb kpwvalid pts tokens tokens.krb udebug vos ; do
 done
 
 # the rest are not needed.
-for f in dlog dpass install knfs livesys xstat_cm_test xstat_fs_test ; do
+for f in dlog dpass install knfs livesys ; do
   rm -f $RPM_BUILD_ROOT%{_bindir}/$f
 done
 
@@ -1210,7 +1251,7 @@ done
 rm -rf $RPM_BUILD_ROOT%{_sbindir}/kdump*
 
 # remove man pages from programs deleted above
-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
+for f in 1/dlog 1/dpass 1/livesys 8/kdb 8/kpwvalid 8/xfs_size_check 1/package_test 5/package 8/package ; do
   rm -f $RPM_BUILD_ROOT%{_mandir}/man$f.*
 done
 
@@ -1236,6 +1277,9 @@ do
     if [ -d _kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}${kvariant}-SP ] ; then
       srcdir=_kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}${kvariant}-SP
       dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}${kvariant}/extra/openafs
+    elif [ -d _kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}.%{_target_cpu}+${kvariant}-SP ] ; then
+      srcdir=_kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}.%{_target_cpu}+${kvariant}-SP
+      dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}.%{_target_cpu}+${kvariant}/extra/openafs
     else
       srcdir=_kmod_build_$kvariant/src/libafs/MODLOAD-%{kverrel}.%{_target_cpu}.${kvariant}-SP
       dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}.%{_target_cpu}.${kvariant}/extra/openafs
@@ -1300,11 +1344,19 @@ if [ -e %{_prefix}/afsws ]; then
 fi
 
 %post client
+%if 0%{?fedora} < 15
 chkconfig --add openafs-client
+%else
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+%endif
 if [ ! -d /afs ]; then
        mkdir /afs
        chown root.root /afs
        chmod 0755 /afs
+       [ -x /sbin/restorecon ] && /sbin/restorecon /afs
 fi
 
 # Create the CellServDB
@@ -1314,24 +1366,19 @@ fi
   cat CellServDB.local CellServDB.dist > CellServDB ; \
   chmod 644 CellServDB )
 
-echo
-echo The AFS cache is configured for 100 MB. Edit the
-echo /usr/vice/etc/cacheinfo file to change this before
-echo running AFS for the first time. You should also
-echo set your home cell in /usr/vice/etc/ThisCell.
-echo
-echo Also, you may want to edit /etc/pam.d/login and
-echo possibly others there to get an AFS token on login.
-echo Put the line:
-echo 
-echo    auth      sufficient   %{pamdir}/pam_afs.so try_first_pass ignore_root
-echo
-echo before the one for pwdb.
-echo
-
 %post server
-chkconfig --add openafs-server
+#on an upgrade, don't enable if we were disabled
+%if 0%{?fedora} < 15
+if [ $1 = 1 ] ; then
+  chkconfig --add openafs-server
+fi
 %{initdir}/openafs-server condrestart
+%else
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+%endif
 
 %if %{build_authlibs}
 %post authlibs
@@ -1344,19 +1391,43 @@ chkconfig --add openafs-server
 %preun
 if [ $1 = 0 ] ; then
        [ -d /afs ] && rmdir /afs
+       :
 fi
 
 %preun client
+%if 0%{?fedora} < 15
 if [ $1 = 0 ] ; then
         %{initdir}/openafs-client stop
         chkconfig --del openafs-client
 fi
+%else
+if [ $1 -eq 0 ] ; then
+       # Package removal, not upgrade
+       /bin/systemctl --no-reload disable openafs-client.service > /dev/null 2>&1 || :
+       /bin/systemctl stop openafs-client.service > /dev/null 2>&1 || :
+fi
+%endif
 
 %preun server
+%if 0%{?fedora} < 15
 if [ $1 = 0 ] ; then
         %{initdir}/openafs-server stop
         chkconfig --del openafs-server
 fi
+%else
+if [ $1 -eq 0 ] ; then
+       /bin/systemctl --no-reload disable openafs-server.service > /dev/null 2>&1 || :
+       /bin/systemctl stop openafs-server.service > /dev/null 2>&1 || :
+fi
+%endif
+
+%if 0%{?fedora} >= 15
+%postun client
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+
+%postun server
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%endif
 
 %if %{build_dkmspkg}
 %post -n dkms-%{name}
@@ -1414,6 +1485,26 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %endif
 %endif
 
+%if 0%{?fedora} >= 15
+%triggerun -- openafs-client < 1.6.0-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save openafs-client >/dev/null 2>&1 ||:
+
+# Run this because the SysV package being removed won't do it
+/sbin/chkconfig --del openafs-client >/dev/null 2>&1 || :
+
+%triggerun -- openafs-server < 1.6.0-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save openafs-server >/dev/null 2>&1 ||:
+
+# Run this because the SysV package being removed won't do it
+/sbin/chkconfig --del openafs-server >/dev/null 2>&1 || :
+%endif
+
 ##############################################################################
 ###
 ### file lists
@@ -1423,12 +1514,18 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 
 %files -f openafs-file-list
 %defattr(-,root,root)
-%config /etc/sysconfig/openafs
+%config(noreplace) /etc/sysconfig/openafs
 %doc %{_docdir}/openafs-%{afsvers}/LICENSE
+%{_libdir}/libafshcrypto.so.*
+%{_libdir}/librokenafs.so.*
 
 %files docs
 %defattr(-,root,root)
-%doc %{_docdir}/openafs-%{afsvers}
+%docdir %{_docdir}/openafs-%{afsvers}
+%dir %{_docdir}/openafs-%{afsvers}
+%{_docdir}/openafs-%{afsvers}/ChangeLog
+%{_docdir}/openafs-%{afsvers}/RELNOTES-%{afsvers}
+%{_docdir}/openafs-%{afsvers}/pdf
 
 %files client
 %defattr(-,root,root)
@@ -1437,8 +1534,9 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %dir %{_prefix}/vice/etc
 %dir %{_prefix}/vice/etc/C
 %{_prefix}/vice/etc/CellServDB.dist
-%config %{_prefix}/vice/etc/ThisCell
-%config %{_prefix}/vice/etc/cacheinfo
+%config(noreplace) %{_prefix}/vice/etc/ThisCell
+%config(noreplace) %{_prefix}/vice/etc/cacheinfo
+%{_bindir}/afsio
 %{_bindir}/cmdebug
 %{_bindir}/up
 %{_prefix}/vice/etc/afsd
@@ -1447,11 +1545,19 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{pamdir}/pam_afs.krb.so
 %{pamdir}/pam_afs.so.1
 %{pamdir}/pam_afs.so
+%if 0%{?fedora} < 15
 %{initdir}/openafs-client
+%else
+%{_unitdir}/openafs-client.service
+%{_sysconfdir}/sysconfig/modules/openafs-client.modules
+%endif
 %{_mandir}/man1/cmdebug.*
 %{_mandir}/man1/copyauth.*
 %{_mandir}/man1/up.*
-%{_mandir}/man5/afs*
+%{_mandir}/man5/afs.5.gz
+%{_mandir}/man5/afs_cache.5.gz
+%{_mandir}/man5/afs_volume_header.5.gz
+%{_mandir}/man5/afszcm.cat.5.gz
 %{_mandir}/man5/cacheinfo.*
 %{_mandir}/man8/afsd.*
 %{_mandir}/man8/rmtsysd.*
@@ -1467,6 +1573,10 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{_prefix}/afs/bin/bosserver
 %{_prefix}/afs/bin/bos_util
 %{_prefix}/afs/bin/buserver
+%{_prefix}/afs/bin/dafileserver
+%{_prefix}/afs/bin/dafssync-debug
+%{_prefix}/afs/bin/dasalvager
+%{_prefix}/afs/bin/davolserver
 %{_prefix}/afs/bin/fileserver
 %{_prefix}/afs/bin/fssync-debug
 # Should we support KAServer?
@@ -1475,6 +1585,8 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{_prefix}/afs/bin/pt_util
 %{_prefix}/afs/bin/ptserver
 %{_prefix}/afs/bin/salvager
+%{_prefix}/afs/bin/salvageserver
+%{_prefix}/afs/bin/salvsync-debug
 %{_prefix}/afs/bin/state_analyzer
 %{_prefix}/afs/bin/upclient
 %{_prefix}/afs/bin/upserver
@@ -1486,7 +1598,11 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{_sbindir}/vldb_check
 %{_sbindir}/vldb_convert
 %{_sbindir}/voldump
+%if 0%{?fedora} < 15
 %{initdir}/openafs-server
+%else
+%{_unitdir}/openafs-server.service
+%endif
 %{_mandir}/man5/AuthLog.*
 %{_mandir}/man5/BackupLog.*
 %{_mandir}/man5/BosConfig.*
@@ -1508,12 +1624,16 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{_mandir}/man5/kaserver.DB0.*
 %{_mandir}/man5/kaserverauxdb.*
 %{_mandir}/man5/krb.conf.*
+%{_mandir}/man5/krb.excl.*
 %{_mandir}/man5/prdb.DB0.*
 %{_mandir}/man5/salvage.lock.*
 %{_mandir}/man5/tapeconfig.*
 %{_mandir}/man5/vldb.DB0.*
 %{_mandir}/man8/buserver.*
 %{_mandir}/man8/fileserver.*
+%{_mandir}/man8/dafileserver.*
+%{_mandir}/man8/dasalvager.*
+%{_mandir}/man8/davolserver.*
 %{_mandir}/man8/kadb_check.*
 %{_mandir}/man8/ka-forwarder.*
 %{_mandir}/man8/prdb_check.*
@@ -1543,6 +1663,7 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %defattr(-,root,root)
 %{_includedir}/kopenafs.h
 %{_libdir}/libafsauthent.a
+%{_libdir}/libafscp.a
 %{_libdir}/libafsrpc.a
 %{_libdir}/libafsauthent_pic.a
 %{_libdir}/libafsrpc_pic.a
@@ -1558,26 +1679,25 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 %{_bindir}/afs_compile_et
 %{_bindir}/rxgen
 %{_includedir}/afs
-%{_includedir}/des.h
-%{_includedir}/des_conf.h
-%{_includedir}/des_odd.h
-%{_includedir}/des_prototypes.h
 %{_includedir}/lock.h
 %{_includedir}/lwp.h
-%{_includedir}/mit-cpyright.h
-%{_includedir}/potpourri.h
 %{_includedir}/preempt.h
 %{_includedir}/rx
 %{_includedir}/timer.h
 %{_includedir}/ubik.h
 %{_includedir}/ubik_int.h
 %{_libdir}/afs
-%{_libdir}/libdes.a
+%{_libdir}/libafshcrypto.a
+%{_libdir}/libafshcrypto.so
 %{_libdir}/liblwp.a
+%{_libdir}/libopr.a
+%{_libdir}/librokenafs.a
+%{_libdir}/librokenafs.so
 %{_libdir}/librx.a
 %{_libdir}/librxkad.a
 %{_libdir}/librxstat.a
 %{_libdir}/libubik.a
+%{_libdir}/libubik_pthread.a
 %{_mandir}/man1/rxgen.*
 %{_mandir}/man1/afs_compile_et.*
 
@@ -1660,7 +1780,7 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 * Wed Dec 12 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
 - Make the RPM mockable
 
-* Tue Oct 29 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
+* Mon Oct 29 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
 - Update to match the shipped 1.4.5 RPMS
 - Fix the kvariant stuff to only configure the 'standard' case once
 - Add openafs-kvers.sh back in