--- /dev/null
+#!/bin/bash
+
+# kmodtool - Helper script for building kernel module RPMs
+# Copyright (c) 2003-2007 Ville Skyttä <ville.skytta@iki.fi>,
+# Thorsten Leemhuis <fedora@leemhuis.info>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+shopt -s extglob
+
+myprog="kmodtool"
+myver="0.10.13"
+knownvariants=@(BOOT|PAE?(-debug)|@(big|huge)mem|debug|enterprise|kdump|?(large)smp?(-debug)|uml|xen?([0U])?(-PAE))
+kmod_name=
+kver=
+verrel=
+variant=
+
+get_verrel ()
+{
+ verrel=${1:-$(uname -r)}
+ verrel=${verrel%%$knownvariants}
+}
+
+print_verrel ()
+{
+ get_verrel $@
+ echo "${verrel}"
+}
+
+get_variant ()
+{
+ get_verrel $@
+ variant=${1:-$(uname -r)}
+ variant=${variant##$verrel}
+ variant=${variant:-'""'}
+}
+
+print_variant ()
+{
+ get_variant $@
+ echo "${variant}"
+}
+
+
+get_rpmtemplate ()
+{
+ local variant="${1}"
+ local dashvariant="${variant:+-${variant}}"
+ case "$verrel" in
+ *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;;
+ *) kdep="kernel-%{_target_cpu} = ${verrel}${variant}" ;;
+ esac
+ cat <<EOF
+%package -n kmod-${kmod_name}${dashvariant}
+Summary: ${kmod_name} kernel module(s)
+Group: System Environment/Kernel
+Provides: kernel-modules = ${verrel}${variant}
+Provides: ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release}
+Requires: ${kdep}
+Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version}
+Requires(post): /sbin/depmod
+Requires(postun): /sbin/depmod
+BuildRequires: kernel${dashvariant}-devel-%{_target_cpu} = ${verrel}
+%description -n kmod-${kmod_name}${dashvariant}
+This package provides the ${kmod_name} kernel modules built for the Linux
+kernel ${verrel}${variant} for the %{_target_cpu} family of processors.
+%post -n kmod-${kmod_name}${dashvariant}
+/sbin/depmod -aeF /boot/System.map-${verrel}${variant} ${verrel}${variant} > /dev/null || :
+%postun -n kmod-${kmod_name}${dashvariant}
+/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || :
+%files -n kmod-${kmod_name}${dashvariant}
+%defattr(644,root,root,755)
+/lib/modules/${verrel}${variant}/extra/${kmod_name}/
+
+EOF
+}
+
+print_rpmtemplate ()
+{
+ kmod_name="${1}"
+ shift
+ kver="${1}"
+ get_verrel "${1}"
+ shift
+ if [ -z "${kmod_name}" ] ; then
+ echo "Please provide the kmodule-name as first parameter." >&2
+ exit 2
+ elif [ -z "${kver}" ] ; then
+ echo "Please provide the kver as second parameter." >&2
+ exit 2
+ elif [ -z "${verrel}" ] ; then
+ echo "Couldn't find out the verrel." >&2
+ exit 2
+ fi
+
+ for variant in "$@" ; do
+ get_rpmtemplate "${variant}"
+ done
+}
+
+usage ()
+{
+ cat <<EOF
+You called: ${invocation}
+
+Usage: ${myprog} <command> <option>+
+ Commands:
+ verrel <uname>
+ - Get "base" version-release.
+ variant <uname>
+ - Get variant from uname.
+ rpmtemplate <mainpgkname> <uname> <variants>
+ - Return a template for
+ version
+ - Output version number and exit.
+EOF
+}
+
+invocation="$(basename ${0}) $@"
+while [ "${1}" ] ; do
+ case "${1}" in
+ verrel)
+ shift
+ print_verrel $@
+ exit $?
+ ;;
+ variant)
+ shift
+ print_variant $@
+ exit $?
+ ;;
+ rpmtemplate)
+ shift
+ print_rpmtemplate "$@"
+ exit $?
+ ;;
+ version)
+ echo "${myprog} ${myver}"
+ exit 0
+ ;;
+ *)
+ echo "Error: Unknown option '${1}'." >&2
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+
+# Local variables:
+# mode: sh
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# End:
+# ex: ts=2 sw=2 et
# Openafs Spec $Revision$
-%define afsvers 1.4.2
-%define pkgvers 1.4.2
+%define afsvers 1.4.5pre1
+%define pkgvers 1.4.5pre1
# for beta/rc releases make pkgrel 0.X.<tag>
# for real releases make pkgrel 1 (or more for extra releases)
#%define pkgrel 0.1.rc1
%define osvers 1
%endif
+%{!?fedorakmod: %define fedorakmod 0}
+
# Determine presence of rpmbuild command line --define arguments used for
# option specification
%define kernvers_on_cmdline %{?kernvers:1}%{!?kernvers:0}
%if !%{kernvers_on_cmdline}
%define kernvers %(%{_sourcedir}/openafs-kernel-version.sh)
%endif
+
+%if %{fedorakmod}
+%define kmodtool bash %{_sourcedir}/kmodtool
+
+%define kmod_name openafs
+%define kverrel %(%{kmodtool} verrel %{?kernvers} 2>/dev/null)
+
+%define upvar ""
+%ifarch i686
+%define paevar PAE
+%endif
+%ifarch ppc
+%define smpvar smp
+%endif
+%ifarch i686 x86_64
+%define xenvar xen
+%define kdumpvar kdump
+%endif
+%{!?kvariants: %define kvariants %{?upvar} %{?smpvar} %{?paevar} %{?xenvar} %{?kdumpvar}}
+
+%define ksrcdir %{_usrsrc}/kernels/%{kverrel}-%{_target_cpu}
+
+%else # Legacy kernel build stuff
+
%define kversis %{_sourcedir}/openafs-kvers-is.sh
%define kvers %(%{kversis} parsev %{kernvers})
%define kvers_is_24 %(%{kversis} %{kvers} "2.4")
%endif
%define kxmoddir %{kmoddir}/%{kernvers}
+# End legacy kernel build stuff
+%endif
+
# 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
%if %{?debugspec:0}%{!?debugspec:1}
# Define the location of the PAM security module directory
%define pamdir /%{_lib}/security
+%if !%{fedorakmod}
+
# Define the set of kernel module variations to be built:
# For 2.4 kernels we just build everything at once for a particular
# kernel. So we build up, smp, and bigmem all at once.
%endif
%endif
+# 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!!!
Source1: http://www.openafs.org/dl/openafs/%{afsvers}/openafs-%{afsvers}-doc.tar.bz2
%define srcdir openafs-%{afsvers}
-Source2: openafs-ThisCell
-# http://grand.central.org/dl/cellservdb/CellServDB
-Source3: openafs-CellServDB
-Source4: openafs-SuidCells
-Source5: openafs-cacheinfo
-# Source6: openafs-afsmodname
-Source7: openafs-LICENSE.Sun
-Source8: openafs-README
Source10: http://www.openafs.org/dl/openafs/%{afsvers}/RELNOTES-%{afsvers}
Source11: http://www.openafs.org/dl/openafs/%{afsvers}/ChangeLog
-Source15: openafs.sysconfig
-Source16: openafs-client.init
-Source17: openafs-server.init
-
-# from ftp://ftp.cmf.nrl.navy.mil/pub/kerberos5/afs-krb5-2.0.tar.gz
-Source20: openafs-krb5-2.0.tar.gz
-
Source30: openafs-kernel-version.sh
-Source31: openafs-buildall.sh
-Source32: openafs-makesrc.sh
-Source33: openafs-kvers-is.sh
+Source999: kmodtool
Patch0: openafs-1.4.0-kmodule26.patch
-#Patch1: openafs-1.4.1-moduleparam.patch
-
-Patch10: afs-krb5-2.0-krb524.patch
-Patch11: afs-krb5-2.0-libsocket.patch
-Patch12: afs-krb5-2.0-com_err.patch
-Patch13: afs-krb5-2.0-openafs1.3.patch
-Patch14: afs-krb5-2.0-res_search.patch
%description
The AFS distributed filesystem. AFS is a distributed filesystem
will be installed. You probably don't
need to change this ever.
+ --define "fedorakmod 1" Build 'Fedora' style kernel modules
+
To a kernel module for your running kernel, just run:
rpmbuild --rebuild --target=`uname -m` openafs-%{pkgvers}-%{osvers}.%{pkgrel}.src.rpm
%if %{build_userspace}
%package client
-Requires: binutils, openafs-kernel, openafs = %{PACKAGE_VERSION}
+Requires: binutils, openafs = %{PACKAGE_VERSION}
+
+%if %{fedorakmod}
+Requires: %{name}-kmod >= %{version}
+Provides: %{name}-kmod-common = %{version}
+%else
+Requires: openafs-kernel
+%endif
+
Summary: OpenAFS Filesystem Client
Group: Networking/Filesystem
Summary: OpenAFS Kernel Module source tree
Group: Networking/Filesystems
Provides: openafs-kernel = %{PACKAGE_VERSION}
+%if %{fedorakmod}
+Provides: %{name}-kmod = %{PACKAGE_VERSION}
+%endif
%description kernel-source
The AFS distributed filesystem. AFS is a distributed filesystem
##############################################################################
%if %{build_modules}
+%if %{fedorakmod}
+%{expand:%(%{kmodtool} rpmtemplate %{kmod_name} %{kverrel} %{kvariants} 2>/dev/null)}
+
+%else
+
+# Legacy kernel compilation code here ...
%define modkversion %(echo %{kernvers} | cut -d- -f1)
%define modkrelease %(echo %{kernvers} | cut -d- -f2)
%define modpkgrel %{modkversion}_%{modkrelease}_%{pkgrel}
This package provides a precompiled AFS kernel module for %{kernvers}.
%endif
+%endif
+# End legacy kernel compilation code ...
%endif
##############################################################################
: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
: @@@
: @@@ kernel version: %{kernvers}
+%if %{fedorakmod}
+: @@@ kernel variations: %{kvariants}
+%else
: @@@ base kernel version:%{kversion}
: @@@ kernel modules dir: %{kxmoddir}
: @@@ kernel source dir: %{ksrcdir}
: @@@ kernel type: %{ktype}
%endif
%endif
+%endif
: @@@ PAM modules dir: %{pamdir}
: @@@ build userspace: %{build_userspace}
: @@@ build modules: %{build_modules}
# Patch openafs to build a kernel module named "openafs" instead of "libafs"
%patch0 -p1 -b .kmod26
-# Patch to work around the Linux 2.6.9 module_param function
-#%patch1 -p0 -b .modparam
-
%if %{build_userspace}
# Save some time -- install these if we're building userspace
# Install the Krb5 Migration Kit
-%setup -q -T -D -a 20 -n %{srcdir}
+tar -xzf src/packaging/RedHat/openafs-krb5-2.0.tar.gz
#
# patch afs-krb5 migration kit to work with openafs-1.3 and krb5-1.3;
#
# krb524 is no longer in a separate library as of krb5-1.3; handle this
-%patch10 -p0 -b .krb524
+patch -p0 -b -z .krb524 < src/packaging/RedHat/afs-krb5-2.0-krb524.patch
# make sure NETLIBS gets added to the proper programs (seems to be
# needed only for Solaris)
-%patch11 -p0 -b .libsocket
+patch -p0 -b -z .libsocket < src/packaging/RedHat/afs-krb5-2.0-libsocket.patch
# find an existing libcom_err and use that
-%patch12 -p0 -b .com_err
+patch -p0 -b -z .com_err < src/packaging/RedHat/afs-krb5-2.0-com_err.patch
# make afs-krb5 work with recent OpenAFS; includes and prototypes
-%patch13 -p0 -b .openafs13
+patch -p0 -b -z .openafs13 < src/packaging/RedHat/afs-krb5-2.0-openafs1.3.patch
# nothing in afs-krb5 actually uses res_search
-%patch14 -p0 -b .res_search
+patch -p0 -b -z .res_search < src/packaging/RedHat/afs-krb5-2.0-res_search.patch
(cd afs-krb5/src && autoreconf) || exit 1
%endif
-
##############################################################################
#
# building
--libdir=%{_libdir} \
--bindir=%{_bindir} \
--sbindir=%{_sbindir} \
+%if %{build_modules}
--with-linux-kernel-headers=%{ksrcdir} \
+%endif
%if %{krb5support}
--with-krb5-conf \
%endif
$config_opts \
|| exit 1
+# Build the libafs tree
+make only_libafs_tree || exit 1
+
+# Configure each of our kernel modules
+
+%if %{fedorakmod} && %{build_modules}
+for kvariant in %{kvariants} ; do
+ cp -R libafs_tree _kmod_build_${kvariant}
+ pushd _kmod_build_${kvariant}
+ ./configure --with-afs-sysname=${sysname} \
+ --prefix=%{_prefix} \
+ --libdir=%{_libdir} \
+ --bindir=%{_bindir} \
+ --sbindir=%{_sbindir} \
+ --with-linux-kernel-headers=%{_usrsrc}/kernels/%{kverrel}${kvariant:+-$kvariant}-%{_target_cpu} \
+%if %{krb5support}
+ --with-krb5-conf \
+%endif
+ $config_opts \
+ || exit 1
+ popd
+done
+%endif
+
%if %{build_userspace}
# Build the user-space AFS stuff
make dest_nolibafs || exit 1
-# Build the libafs tree
-make only_libafs_tree || exit 1
-
%if %{krb5support}
# Now build ka-forwarder
(cd afs-krb5/src &&
%endif
%if %{build_modules}
+%if %{fedorakmod}
+for kvariant in %{kvariants}
+do
+ pushd _kmod_build_$kvariant;
+ make all MPS=SP
+ popd
+done
+
+%else
+# Begin legacy kernel module building code
+
%if %{kvers_is_24}
# Build all the kernel modules for linux 2.4.x
for variation in %{kvariations}
# the MPS=SP just means that we don't add a '.mp' to the name.
make dest_only_libafs MPS=SP
+%endif
+# End legacy kernel module building code
%endif
%endif
ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
# Copy root.client config files
-install -m 755 %{SOURCE15} $RPM_BUILD_ROOT/etc/sysconfig/openafs
-install -m 755 %{SOURCE16} $RPM_BUILD_ROOT%{initdir}/openafs-client
-install -m 755 %{SOURCE17} $RPM_BUILD_ROOT%{initdir}/openafs-server
+install -m 755 src/packaging/RedHat/openafs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openafs
+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
# Copy PAM modules
install -m 755 ${sysname}/dest/lib/pam* $RPM_BUILD_ROOT%{pamdir}
# Populate /usr/vice/etc
uve=$RPM_BUILD_ROOT%{_prefix}/vice/etc
-install -p -m 644 %{SOURCE2} $uve/ThisCell
-install -p -m 644 %{SOURCE3} $uve/CellServDB.dist
-install -p -m 644 %{SOURCE4} $uve/SuidCells.dist
-install -p -m 644 %{SOURCE5} $uve/cacheinfo
+install -p -m 644 src/packaging/RedHat/openafs-ThisCell $uve/ThisCell
+install -p -m 644 src/afsd/CellServDB $uve/CellServDB.dist
+install -p -m 644 src/packaging/RedHat/openafs-cacheinfo $uve/cacheinfo
#
# install kernel-source
# Next, copy the LICENSE Files, README
install -m 644 src/LICENSE $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.IBM
-install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.Sun
-install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/README
+install -m 644 src/packaging/RedHat/openafs-LICENSE.Sun $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/LICENSE.Sun
+install -m 644 src/packaging/RedHat/openafs-README $RPM_BUILD_ROOT%{_prefix}/src/openafs-kernel-%{afsvers}/README
#
# Install DOCUMENTATION
%{_sbindir}/fms
%{_sbindir}/fstrace
%{_sbindir}/kas
-%{_sbindir}/kseal
%{_sbindir}/read_tape
%{_sbindir}/restorevol
%{_sbindir}/rxdebug
%endif
%if %{build_modules}
+%if %{fedorakmod}
+for kvariant in %{kvariants}
+do
+ pushd _kmod_build_$kvariant
+ srcdir=src/libafs/MODLOAD-%{kverrel}${kvariant}-SP
+ dstdir=$RPM_BUILD_ROOT/lib/modules/%{kverrel}${kvariant}/extra/openafs
+
+ mkdir -p ${dstdir}
+ install -m 744 ${srcdir}/libafs-%{kverrel}${kvariant}.ko $dstdir/openafs.ko
+ popd
+done
+%else
# Install the kernel modules
for variation in %{kvariations}
do
install -m 744 ${srcdir}/${modname} ${dstdir}/openafs${kmodend}
done
%endif
+%endif
##############################################################################
###
chmod 0755 /afs
fi
-# Create the CellServDB and SuidCells
+# Create the CellServDB
[ -f /usr/vice/etc/CellServDB.local ] || touch /usr/vice/etc/CellServDB.local
-[ -f /usr/vice/etc/SuidCells.local ] || touch /usr/vice/etc/SuidCells.local
( cd /usr/vice/etc ; \
cat CellServDB.local CellServDB.dist > CellServDB ; \
- chmod 644 CellServDB ; \
- cat SuidCells.local SuidCells.dist > SuidCells ; \
- chmod 644 SuidCells )
+ chmod 644 CellServDB )
echo
echo The AFS cache is configured for 100 MB. Edit the
if [ $1 = 0 ] ; then
%{initdir}/openafs-client stop
chkconfig --del openafs-client
-
- rm -f /usr/vice/etc/CellServDB /usr/vice/etc/SuidCells
- rm -f /usr/vice/etc/CellServDB.local /usr/vice/etc/SuidCells.local
fi
%preun server
%endif
%if %{build_modules}
-
+%if !%{fedorakmod}
%if %{up_package}
%post kernel
/sbin/depmod -ae %{kernvers}
%postun kernel-hugemem
/sbin/depmod -ae %{kernvers}%{?hugemem_ext:%{hugemem_ext}}
%endif
-
+%endif
%endif
%dir %{_prefix}/vice/cache
%dir %{_prefix}/vice/etc
%{_prefix}/vice/etc/CellServDB.dist
-%{_prefix}/vice/etc/SuidCells.dist
%config %{_prefix}/vice/etc/ThisCell
%config %{_prefix}/vice/etc/cacheinfo
%{_bindir}/cmdebug
%{_mandir}/man5/afs*
%{_mandir}/man5/cacheinfo.*
%{_mandir}/man8/afsd.*
+%{_mandir}/man5/CellAlias.*
%files server
%defattr(-,root,root)
%{_prefix}/afs/bin/fileserver
# Should we support KAServer?
%{_prefix}/afs/bin/kaserver
+%{_prefix}/afs/bin/ka-forwarder
%{_prefix}/afs/bin/pt_util
%{_prefix}/afs/bin/ptserver
%{_prefix}/afs/bin/salvager
%{_mandir}/man8/buserver.*
%{_mandir}/man8/fileserver.*
%{_mandir}/man8/kadb_check.*
+%{_mandir}/man8/ka-forwarder.*
%{_mandir}/man8/prdb_check.*
%{_mandir}/man8/ptserver.*
+%{_mandir}/man8/pt_util.*
%{_mandir}/man8/salvager.*
%{_mandir}/man8/upclient.*
%{_mandir}/man8/upserver.*
%if %{build_modules}
+%if !%{fedorakmod}
%if %{up_package}
%files kernel
%defattr(-,root,root)
%defattr(-,root,root)
%{kxmoddir}%{?hugemem_ext:%{hugemem_ext}}/kernel/fs/openafs/openafs.*
%endif
+%endif
%endif
###
##############################################################################
%changelog
+* Wed Oct 10 2007 Simon Wilkinson <simon@sxw.org.uk> 1.4.5pre1-1
+- Use Fedora style kmods, which allows us to install multiple kernel types
+
+* Thu Jun 07 2007 Simon Wilkinson <simon@sxw.org.uk> 1.4.4-3
+- Use distributed files, rather than those in packager's SOURCE directory
+- Remove SuidCells stuff, which was unused
+
* Fri Dec 01 2006 Derrick Brashear <shadow@dementia.org> 1.4.2-2
- integrate s390x changes
- allow for building libafs*.a and not libafs*.so into packages, for platforms
that won't build the .so files.
-* Sun Aug 20 2006 Derrick Brashear <shadow@dementia.org> 1.4.2-1
+* Wed Aug 23 2006 Derrick Brashear <shadow@dementia.org> 1.4.2-1
- update to 1.4.2
- use installed aklog manpage.
- moduleparam patch obsoleted.