From 9ba1d32b4ba8aac1d7e2c7f7489739e0e4ca5475 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 1 Dec 2006 18:32:49 +0000 Subject: [PATCH] redhat-packaging-updates-20061201 updates from derek updates for s390x updates to handle suse --- src/packaging/RedHat/openafs-README | 56 +++++--- src/packaging/RedHat/openafs-buildall.sh | 18 ++- src/packaging/RedHat/openafs-client.init | 10 ++ src/packaging/RedHat/openafs-kvers-is.sh | 20 ++- src/packaging/RedHat/openafs.spec.in | 162 +++++++++++++++++++---- 5 files changed, 220 insertions(+), 46 deletions(-) diff --git a/src/packaging/RedHat/openafs-README b/src/packaging/RedHat/openafs-README index 81a688ba3..0c84d7f22 100644 --- a/src/packaging/RedHat/openafs-README +++ b/src/packaging/RedHat/openafs-README @@ -2,28 +2,52 @@ The files in the src directory are covered by the IBM Public License and the SUN ONC RPC license, with are included in the files LICENSE.IBM and LICENSE.Sun in the same directory as this README. +There are two ways to build the AFS kernel module on the local system: +Building an RPM and Building Manually + + + REBUILDING FROM SOURCE RPM + -------------------------- + +The first (and preferred) way to build a kernel module is to build an +openafs-kernel RPM from the OpenAFS Source RPM. To do this you can +just use "rpm --rebuild" from the Source RPM (SRPM) and specify that +you want to build a module and the target CPU. For example: + + rpmbuild --rebuild --define "build_modules 1" --target=i686 + +You MUST specify the target CPU or it will not build the correct +module for your system. + +For more information on all the various options for rebuilding your +kernel module via RPM, run: + + rpm -qi openafs + +This will explain all your options for controlling your build. + + + REBUILDING MANUALLY + ------------------- + +The second method to build a kernel module is to build it manually +from source. You really should just build the RPM, but if you really +don't want to you can do it this way instead. + To build the AFS kernel module on a local system, run: ./configure make When it's done, the binary module will be src/MODLOAD-XXX/libafs-XXX.o -and must be manually installed for your kernel. To do this you -generally copy the file to /usr/vice/etc/modload: - - cp src/MODLOAD-XXX/libafs-XXX.o /usr/vice/etc/modload/ +(or .ko), where "XXX" is your linux kernel version. Note that it may +also compile as src/MODLOAD-XXX/openafs.ko. -Then you need to add this module to your SymTable by using "afsmodname" -to generate a new SymTable: +You must manually install this module on your system. To do this you +generally copy the file to /lib/modules/XXX/openafs.o: - cd /usr/vice/etc/modload - ../afsmodname -f SymTable.local -g libafs-XXX.o + cp src/MODLOAD-XXX/libafs-XXX.o /lib/modules/XXX/openafs.o -NOTE: This only works if you have your kernel compiled with symbol -version support. Without symbol version support you will not be able -to choose kernel modules. If you compile without kernel module -support then you need to remove the SymTable file from -/usr/vice/etc/modload to allow the init scripts to choose a module -based on 'uname -r' instead of /proc/ksyms. Keep in mind that using -/proc/ksyms is MUCH better, so it is NOT recommended to use this -method! +Then you need to tell your system about the new kernel module by +running "depmod -ae XXX" to run the module dependencies for kernel +version "XXX". diff --git a/src/packaging/RedHat/openafs-buildall.sh b/src/packaging/RedHat/openafs-buildall.sh index 39fb6e679..305405d4b 100755 --- a/src/packaging/RedHat/openafs-buildall.sh +++ b/src/packaging/RedHat/openafs-buildall.sh @@ -15,19 +15,27 @@ buildopts= ############################################################################ # Figure out the release version -rhrel=`cat /etc/redhat-release` +[ -f /etc/redhat-release ] && rhrel=`cat /etc/redhat-release` +[ -f /etc/SuSE-release ] && rhrel=`head -1 /etc/SuSE-release` + if [ `echo $rhrel | grep -c 'Fedora Core'` = 1 ] ; then ostype='fc' + osrel=`echo $rhrel | sed -e 's/^.*release \([^ ]*\).*$/\1/' -e 's/\.//g'` elif [ `echo $rhrel | grep -c 'Red Hat Enterprise Linux'` = 1 ] ; then ostype='rhel' excludearch=i586 + osrel=`echo $rhrel | sed -e 's/^.*release \([^ ]*\).*$/\1/' -e 's/\.//g'` elif [ `echo $rhrel | grep -c 'Red Hat Linux'` = 1 ] ; then ostype='rh' + osrel=`echo $rhrel | sed -e 's/^.*release \([^ ]*\).*$/\1/' -e 's/\.//g'` +elif [ `echo $rhrel | grep -c 'SUSE LINUX'` = 1 ] ; then + ostype='suse' + specdir=/usr/src/packages/SPECS + osrel=`grep VERSION /etc/SuSE-release|awk '{print $3}'` else echo "Unknown Linux Release: $rhrel" exit 1 fi -osrel=`echo $rhrel | sed -e 's/^.*release \([^ ]*\).*$/\1/' -e 's/\.//g'` osvers="$ostype$osrel" ############################################################################ @@ -35,13 +43,14 @@ osvers="$ostype$osrel" # kernel version is "close enough" to tell us whether it's a # 2.4 or 2.6 kernel. kvers=`uname -r` +kbase=/usr/src/linux- + case $kvers in 2.4.*) - kbase=/usr/src/linux- kv=2.4. ;; 2.6.*) - kbase=/usr/src/kernels/ + [ -d /usr/src/kernels ] && kbase=/usr/src/kernels/ kv=2.6. ;; *) @@ -49,7 +58,6 @@ case $kvers in exit 1 ;; esac - ############################################################################ # Now build the packages and all the kernel modules diff --git a/src/packaging/RedHat/openafs-client.init b/src/packaging/RedHat/openafs-client.init index 2de4dd418..a2cdfb6ee 100644 --- a/src/packaging/RedHat/openafs-client.init +++ b/src/packaging/RedHat/openafs-client.init @@ -12,6 +12,16 @@ start() { + echo -n $"Updating CellServDB: " + cat /usr/vice/etc/CellServDB.local /usr/vice/etc/CellServDB.dist > \ + /usr/vice/etc/CellServDB + chmod 644 /usr/vice/etc/CellServDB + echo + echo -n $"Updating SuidCells: " + cat /usr/vice/etc/SuidCells.local /usr/vice/etc/SuidCells.dist > \ + /usr/vice/etc/SuidCells + chmod 644 /usr/vice/etc/SuidCells + echo echo -n $"Starting openafs-client: " if [ -e /var/lock/subsys/openafs-client ] ; then echo -n $"cannot start openafs-client: already running" diff --git a/src/packaging/RedHat/openafs-kvers-is.sh b/src/packaging/RedHat/openafs-kvers-is.sh index b69f8dfb6..c96a08e28 100755 --- a/src/packaging/RedHat/openafs-kvers-is.sh +++ b/src/packaging/RedHat/openafs-kvers-is.sh @@ -10,13 +10,16 @@ fi if [ "$1" = "parset" ] ; then #logger "parsing type from $2" - echo "$2" | /bin/sed -e 's/^.*[0-9L]\([^0-9L]*\)/\1/' + case "$2" in + *smp) echo 'smp' ;; + *hugemem) echo 'hugemem' ;; + esac exit 0 fi if [ "$1" = "kvers" ] ; then #logger "parsing type from $2" - echo "$2" | /bin/sed -e 's/^\(.*[0-9L]\)[^0-9L]*$/\1/' + echo "$2" | /bin/sed -re 's/smp$//; s/hugemem$//;' exit 0 fi @@ -31,6 +34,19 @@ if [ "$1" = "find" ] ; then fi fi +# provideskernelarch ksrcdir targetcpu +if [ "$1" = "provideskernelarch" ]; then + kernelrpm=`rpm -qf "$2"` + if [ -n "$kernelrpm" ]; then + if rpm -q --provides "$kernelrpm" |egrep -q "^kernel(|-devel)-$3 "; then + echo 1 + exit 1 + fi + fi + echo 0 + exit 0 +fi + #logger "comparing $1 to $2" if [ "$1" = "$2" ] ; then #logger "yes" diff --git a/src/packaging/RedHat/openafs.spec.in b/src/packaging/RedHat/openafs.spec.in index 67bb8716e..dcb22d109 100644 --- a/src/packaging/RedHat/openafs.spec.in +++ b/src/packaging/RedHat/openafs.spec.in @@ -2,6 +2,9 @@ %define afsvers 1.4.2 %define pkgvers 1.4.2 +# for beta/rc releases make pkgrel 0.X. +# for real releases make pkgrel 1 (or more for extra releases) +#%define pkgrel 0.1.rc1 %define pkgrel 1 %if %{?osvers:0}%{!?osvers:1} @@ -65,6 +68,9 @@ # Define the location of your init.d directory %define initdir /etc/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 @@ -88,9 +94,7 @@ %define kdepend kernel-source %define up_package 1 %define smp_package 1 -%define largesmp_package 1 %define smp_ext smp -%define largesmp_ext largesmp %define bigmem_package %(%{kversis} find %{ksrcdir} %{_target_cpu} bigmem) %if %{bigmem_package} @@ -102,17 +106,22 @@ %define hugemem_ext hugemem %endif -%define kvariations up smp largesmp %{?bigmem_ext:%{bigmem_ext}} %{?hugemem_ext:%{hugemem_ext}} +%define kvariations up smp %{?bigmem_ext:%{bigmem_ext}} %{?hugemem_ext:%{hugemem_ext}} ####################################################################### # 2.6 %else %if %{kvers_is_26} %define kvariations up +%ifarch s390x +%define ktype "smp" +%define up_package 1 +%else %define up_package %(%{kversis} "%{ktype}" "") %define smp_package %(%{kversis} "%{ktype}" "smp") -%define largesmp_package %(%{kversis} "%{ktype}" "largesmp") %define hugemem_package %(%{kversis} "%{ktype}" "hugemem") +%define largesmp_package %(%{kversis} "%{ktype}" "largesmp") +%endif %if !%{up_package} && !%{smp_package} && !%{hugemem_package} && !%{largesmp_package} %error "unknown kernel type: %{ktype}" @@ -140,19 +149,26 @@ # you'll need to tweak that last bit. %if !%{build_userspace_on_cmdline} && !%{build_modules_on_cmdline} -%ifarch x86_64 ia64 +%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 @@ -179,7 +195,10 @@ URL: http://www.openafs.org BuildRoot: %{_tmppath}/%{name}-%{version}-root Packager: Derek Atkins Group: Networking/Filesystems -BuildRequires: %{?kdepend:%{kdepend}, } pam-devel +BuildRequires: %{?kdepend:%{kdepend}, } pam-devel, ncurses-devel +%if %{build_userspace} +BuildRequires: autoconf +%endif ExclusiveArch: %{ix86} x86_64 ia64 # http://dl.openafs.org/dl/openafs/candidate/%{afsvers}/... @@ -299,6 +318,7 @@ administrative management. This package provides basic server support to host files in an AFS Cell. +%if %{build_authlibs} %package authlibs Summary: OpenAFS authentication shared libraries Group: Networking/Filesystems @@ -313,9 +333,12 @@ This package provides a shared version of libafsrpc and libafsauthent. None of the programs included with OpenAFS currently use these shared libraries; however, third-party software that wishes to perform AFS authentication may link against them. +%endif %package authlibs-devel +%if %{build_authlibs} Requires: openafs-authlibs = %{PACKAGE_VERSION} +%endif Requires: openafs-devel = %{PACKAGE_VERSION} Summary: OpenAFS shared library development Group: Development/Filesystems @@ -408,7 +431,7 @@ you are using KAserver instead of Krb5. Summary: OpenAFS programs to use with krb5 Requires: openafs = %{PACKAGE_VERSION} Group: Networking/Filesystems -BuildRequires: krb5-devel +BuildRequires: krb5-devel, autoconf, automake %description krb5 The AFS distributed filesystem. AFS is a distributed filesystem @@ -438,9 +461,13 @@ krb4 lookalike services. %package kernel Summary: OpenAFS Kernel Module (compiled for UP) Release: %{modpkgrel} -Provides: openafs-kernel = %{PACKAGE_VERSION} -Requires: kernel = %{kversion} Group: Networking/Filesystems +Provides: openafs-kernel = %{PACKAGE_VERSION} +%if %{kprovidesarch} +Requires: kernel-%{_target_cpu} = %{kversion} +%else +Requires: /boot/config-%{kernvers} +%endif %description kernel The AFS distributed filesystem. AFS is a distributed filesystem @@ -456,7 +483,11 @@ This package provides a precompiled AFS kernel module for %{kernvers}. Summary: OpenAFS Kernel Module (compiled for SMP) Release: %{modpkgrel} Provides: openafs-kernel = %{PACKAGE_VERSION} -Requires: kernel-smp = %{kversion} +%if %{kprovidesarch} +Requires: kernel-smp-%{_target_cpu} = %{kversion} +%else +Requires: /boot/config-%{kernvers}%{?smp_ext:%{smp_ext}} +%endif Group: Networking/Filesystems %description kernel-smp @@ -473,7 +504,11 @@ This package provides a precompiled AFS kernel module for %{kernvers}. Summary: OpenAFS Kernel Module (compiled for LARGESMP) Release: %{modpkgrel} Provides: openafs-kernel = %{PACKAGE_VERSION} -Requires: kernel-largesmp = %{kversion} +%if %{kprovidesarch} +Requires: kernel-largesmp-%{_target_cpu} = %{kversion} +%else +Requires: /boot/config-%{kernvers}%{?largesmp_ext:%{largesmp_ext}} +%endif Group: Networking/Filesystems %description kernel-largesmp @@ -490,7 +525,11 @@ This package provides a precompiled AFS kernel module for %{kernvers}. Summary: OpenAFS Kernel Module (compiled for SMP & big memory support) Release: %{modpkgrel} Provides: openafs-kernel = %{PACKAGE_VERSION} -Requires: kernel-bigmem = %{kversion} +%if %{kprovidesarch} +Requires: kernel-bigmem-%{_target_cpu} = %{kversion} +%else +Requires: /boot/config-%{kernvers}%{?bigmem_ext:%{bigmem_ext}} +%endif Group: Networking/Filesystems %description kernel-bigmem @@ -507,7 +546,11 @@ This package provides a precompiled AFS kernel module for %{kernvers}. Summary: OpenAFS Kernel Module (compiled for SMP & huge memory support) Release: %{modpkgrel} Provides: openafs-kernel = %{PACKAGE_VERSION} -Requires: kernel-hugemem = %{kversion} +%if %{kprovidesarch} +Requires: kernel-hugemem-%{_target_cpu} = %{kversion} +%else +Requires: /boot/config-%{kernvers}%{?hugemem_ext:%{hugemem_ext}} +%endif Group: Networking/Filesystems %description kernel-hugemem @@ -876,8 +919,8 @@ ln -sf pam_afs.krb.so.1 $RPM_BUILD_ROOT%{pamdir}/pam_afs.krb.so # 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 -install -p -m 644 %{SOURCE4} $uve/SuidCells +install -p -m 644 %{SOURCE3} $uve/CellServDB.dist +install -p -m 644 %{SOURCE4} $uve/SuidCells.dist install -p -m 644 %{SOURCE5} $uve/cacheinfo # @@ -1041,6 +1084,11 @@ for f in afs2k5db fakeka ; do rm -f $RPM_BUILD_ROOT%{_sbindir}/$f done +%if !%{build_authlibs} +rm -f $RPM_BUILD_ROOT%{_libdir}/libafsauthent.so +rm -f $RPM_BUILD_ROOT%{_libdir}/libafsrpc.so +%endif + %endif %if %{build_modules} @@ -1057,7 +1105,7 @@ do fi srcdir=${sysname}/dest/root.client%{_prefix}/vice/etc/modload - dstdir=$RPM_BUILD_ROOT${kvar}/kernel/fs/openafs + dstdir=$RPM_BUILD_ROOT${kvar}/fs/openafs mkdir -p ${dstdir} @@ -1098,6 +1146,16 @@ if [ ! -d /afs ]; then chmod 0755 /afs fi +# Create the CellServDB and SuidCells +[ -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 ) + echo echo The AFS cache is configured for 100 MB. Edit the echo /usr/vice/etc/cacheinfo file to change this before @@ -1117,11 +1175,13 @@ echo chkconfig --add openafs-server %{initdir}/openafs-server condrestart +%if %{build_authlibs} %post authlibs /sbin/ldconfig %postun authlibs /sbin/ldconfig +%endif %preun if [ $1 = 0 ] ; then @@ -1132,6 +1192,9 @@ fi 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 @@ -1209,8 +1272,8 @@ fi %dir %{_prefix}/vice %dir %{_prefix}/vice/cache %dir %{_prefix}/vice/etc -%config %{_prefix}/vice/etc/CellServDB -%config %{_prefix}/vice/etc/SuidCells +%{_prefix}/vice/etc/CellServDB.dist +%{_prefix}/vice/etc/SuidCells.dist %config %{_prefix}/vice/etc/ThisCell %config %{_prefix}/vice/etc/cacheinfo %{_bindir}/cmdebug @@ -1292,17 +1355,21 @@ fi %{_mandir}/man8/volserver.* #%{_mandir}/man8/vldb_convert.* +%if %{build_authlibs} %files authlibs %defattr(-,root,root) %{_libdir}/libafsauthent.so.* %{_libdir}/libafsrpc.so.* +%endif %files authlibs-devel %defattr(-,root,root) %{_libdir}/libafsauthent.a -%{_libdir}/libafsauthent.so %{_libdir}/libafsrpc.a +%if %{build_authlibs} +%{_libdir}/libafsauthent.so %{_libdir}/libafsrpc.so +%endif %files devel %defattr(-,root,root) @@ -1363,25 +1430,25 @@ fi %if %{up_package} %files kernel %defattr(-,root,root) -%{kxmoddir}/kernel/fs/openafs/openafs.* +%{kxmoddir}/fs/openafs/openafs.* %endif %if %{smp_package} %files kernel-smp %defattr(-,root,root) -%{kxmoddir}%{?smp_ext:%{smp_ext}}/kernel/fs/openafs/openafs.* +%{kxmoddir}%{?smp_ext:%{smp_ext}}/fs/openafs/openafs.* %endif %if %{largesmp_package} %files kernel-largesmp %defattr(-,root,root) -%{kxmoddir}%{?largesmp_ext:%{largesmp_ext}}/kernel/fs/openafs/openafs.* +%{kxmoddir}%{?largesmp_ext:%{largesmp_ext}}/fs/openafs/openafs.* %endif %if %{bigmem_package} %files kernel-bigmem %defattr(-,root,root) -%{kxmoddir}%{?bigmem_ext:%{bigmem_ext}}/kernel/fs/openafs/openafs.* +%{kxmoddir}%{?bigmem_ext:%{bigmem_ext}}/fs/openafs/openafs.* %endif %if %{hugemem_package} @@ -1398,11 +1465,60 @@ fi ### ############################################################################## %changelog +* Fri Dec 01 2006 Derrick Brashear 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 1.4.2-1 - update to 1.4.2 - use installed aklog manpage. - moduleparam patch obsoleted. +* Tue Aug 22 2006 Derek Atkins 1.4.2-0.1.rc1 +- update to 1.4.2-rc1 +- hand-apply lee damon's changes to support largesmp kernels from RHEL4 + (but only add support for 2.6 kernels. No need for the 2.4 kernels). +- don't need the posixlock patch anymore. + +* Wed Jul 12 2006 Derek Atkins 1.4.2-0.beta2 +- update to 1.4.2-beta2 +- add linux2.4 posixlock API patch + +* Mon Jun 26 2006 Derek Atkins +- moduleparam and krb524 patches no longer required in OA-CVS + +* Wed May 17 2006 Derek Atkins +- change non-target-cpu kernel dep to a file dep +- make sure we use the proper kernel version for the dependency. + +* Tue May 16 2006 Derek Atkins +- allow users to specify local CellServDB and SuidCells entries + don't overwrite user's changes. Provide a .dist an let users + make entries in a ".local" +- build the CellServDB and SuidCells at client startup and at + client install-time +- add provideskernelarch functionality to openafs-kvers-is.sh +- use that functionality to Require kernel{,-}-targetcpu + to get better package safety due to RPM bugs where the kernel + release isn't used so you can install the kernel module against + any kernel of the same major version. + +* Mon May 15 2006 Derek Atkins +- update the README in openafs-kernel-source +- fix openafs-kvers-is.sh from Alexander Bergolth's patch. +- move kernel module from .../kernel/fs/openafs to .../fs/openafs/ + +* Fri Apr 21 2006 Derek Atkins +- build requires autoconf and automake for krb5support + and autoconf for standard package +- dont setup the krb5 migration kit (or patches) if we don't care. +- require ncurses-devel to build + +* Wed Apr 19 2006 Derek Atkins 1.4.1-3 +- look for krb524 functions in libkrb524 if we can't find them + in the standard locations. + * Tue Apr 18 2006 Derek Atkins 1.4.1-2 - fix the module_param_array macro for Linux 2.6.9. -- 2.39.5