%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
%if %{kern24}
%define fedorakmod 0
%endif
+%endif
%if %{fedorakmod}
%define kmodtool bash %{_sourcedir}/openafs-kmodtool
# 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}
-
-%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
# Make sure RPM doesn't complain about installed but non-packaged files.
Packager: OpenAFS Gatekeepers <openafs-gatekeepers@openafs.org>
Group: Networking/Filesystems
BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel, flex, bison
-BuildRequires: perl-devel perl-ExtUtils-Embed
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+BuildRequires: systemd-units
+%endif
+%if 0%{?fedora} >= 15 || 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}/...
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.2011-08-14
+Source20: http://dl.central.org/dl/cellservdb/CellServDB.2013-01-28
Source30: openafs-kernel-version.sh
Source996: openafs-kvers-is.sh
--without krb5 Disable krb5 support (default: with krb5)
--with bitmap-later Enable "bitmap later" support
--with bos-restricted Enable "bos restricted" mode
- --with largefiles Enable "largefile fileserver" mode
--with supergroups Enable "supergroups"
--target=i386 The target architecture to build for.
%package client
Requires: binutils, openafs = %{version}
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+Requires: systemd-units
+Requires(post): systemd-units, systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
%if %{fedorakmod}
Requires: %{name}-kmod >= %{version}
Requires: openafs = %{version}
Summary: OpenAFS Filesystem Server
Group: Networking/Filesystems
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+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
#
##############################################################################
%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} ;;
config_opts="--enable-redhat-buildsys \
%{?_with_bitmap_later:--enable-bitmap-later} \
%{?_with_bos_restricted:--enable-bos-restricted-mode} \
- %{?_with_largefiles:--enable-largefile-fileserver} \
%{?_with_supergroups:--enable-supergroups} \
--enable-transarc-paths"
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
%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
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} ;;
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
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
# Copy root.client config files
install -m 755 src/packaging/RedHat/openafs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openafs
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
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}
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]="KMODNAME=openafs.ko; DSTKMOD=\\".\\"; [ \\"\\\`echo \\"\${kernelver_array[0]}\${kernelver[0]}\\" | sed -e 's/^\\([0-9]*\\.[0-9]*\\)\\..*/\\1/'\\\`\\" = \\"2.4\\" ] && KMODNAME=\\"libafs-*\\" && DSTKMOD=openafs.o; ./configure --with-linux-kernel-headers=\${kernel_source_dir} --with-linux-kernel-packaging; make; 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
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
fi
%post client
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
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
%post server
#on an upgrade, don't enable if we were disabled
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
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
%preun
if [ $1 = 0 ] ; then
[ -d /afs ] && rmdir /afs
+ :
fi
%preun client
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
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 && 0%{?rhel} < 7
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 || 0%{?rhel} >= 7
+%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}
%endif
%endif
+%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7
+%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
%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.*
%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
%{pamdir}/pam_afs.krb.so
%{pamdir}/pam_afs.so.1
%{pamdir}/pam_afs.so
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
%{initdir}/openafs-client
+%else
+%{_unitdir}/openafs-client.service
+%{_sysconfdir}/sysconfig/modules/openafs-client.modules
+%endif
%{_mandir}/man1/cmdebug.*
%{_mandir}/man1/copyauth.*
%{_mandir}/man1/up.*
%{_sbindir}/vldb_check
%{_sbindir}/vldb_convert
%{_sbindir}/voldump
+%if 0%{?fedora} < 15 && 0%{?rhel} < 7
%{initdir}/openafs-server
+%else
+%{_unitdir}/openafs-server.service
+%endif
%{_mandir}/man5/AuthLog.*
%{_mandir}/man5/BackupLog.*
%{_mandir}/man5/BosConfig.*
%{_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.*
* 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