Author: ktdreyer
Update of /cvs/free/rpms/openafs/devel
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv25089
Modified Files:
openafs.spec
Added Files:
afs.conf.systemd openafs-1.6.1-systemd-env-vars.patch
openafs-1.6.1-systemd-execpoststart.patch
openafs-1.6.1-systemd-fhs.patch
openafs-1.6.1-systemd-kmod-name.patch
openafs-1.6.1-systemd-no-cellservdb.patch sysnames
Log Message:
* Mon Oct 8 2012 Ken Dreyer <ktdreyer(a)ktdreyer.com> 0:1.6.1-6
- Enable systemd unit files for F18 and above
--- NEW FILE afs.conf.systemd ---
# Use this file to pass additional options to the afsd and bosserver
# executables.
# Systemd will pass $AFSD_ARGS to afsd.
# You may want to add more settings below.
AFSD_ARGS="-nosettime -afsdb -dynroot"
# Memory cache or disk cache?
CACHE="-memcache"
#CACHE="-cachedir /var/cache/openafs"
# Fine-tuned AFS client configuration options:
# Large:
#OPTIONS="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
# Medium:
#OPTIONS="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
# Small:
#OPTIONS="-stat 300 -dcache 100 -daemons 2 -volumes 50"
# Directory to use for configuration information:
CONFDIR="-confdir /etc/openafs"
# AFS server initialization
#BOSSERVER_ARGS=
openafs-1.6.1-systemd-env-vars.patch:
openafs-client.service | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- NEW FILE openafs-1.6.1-systemd-env-vars.patch ---
From 1e9b8058d1da1ebde09cd280cf441a4af56e254a Mon Sep 17 00:00:00 2001
From: Ken Dreyer <ktdreyer(a)ktdreyer.com>
Date: Mon, 8 Oct 2012 20:59:43 -0600
Subject: [PATCH 4/5] systemd: add more environment variables to
openafs-client.service
At the risk of deviating too far from upstream, this permits a few more
user-friendly environment variables in /etc/sysconfig/openafs.
Change-Id: Ib0938b2865005fc1f1b1c49dfda0d4bf92957004
---
src/packaging/RedHat/openafs-client.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/packaging/RedHat/openafs-client.service
b/src/packaging/RedHat/openafs-client.service
index 89a344f..719aed77 100644
--- a/src/packaging/RedHat/openafs-client.service
+++ b/src/packaging/RedHat/openafs-client.service
@@ -6,7 +6,7 @@ After=syslog.target network.target
Type=forking
EnvironmentFile=/etc/sysconfig/openafs
ExecStartPre=/sbin/modprobe openafs
-ExecStart=/usr/sbin/afsd $AFSD_ARGS
+ExecStart=/usr/sbin/afsd $AFSD_ARGS $CACHE $OPTIONS $CONFDIR
ExecStop=/bin/umount /afs
ExecStop=/usr/sbin/afsd -shutdown
ExecStop=/sbin/rmmod libafs
--
1.7.11.7
openafs-1.6.1-systemd-execpoststart.patch:
openafs-client.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- NEW FILE openafs-1.6.1-systemd-execpoststart.patch ---
From a105ddc4136df2b0d8f6b143a5e46d353a5ea128 Mon Sep 17 00:00:00 2001
From: Ken Dreyer <ktdreyer(a)ktdreyer.com>
Date: Mon, 8 Oct 2012 21:01:52 -0600
Subject: [PATCH 5/5] systemd: run "sysnames" script after starting afsd
This helper script will set any custom sysnames on the client.
Change-Id: Ibdb770fac20eb26b137bd02a71a52e0c801b039d
---
src/packaging/RedHat/openafs-client.service | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/packaging/RedHat/openafs-client.service
b/src/packaging/RedHat/openafs-client.service
index 719aed77..aac1ca7 100644
--- a/src/packaging/RedHat/openafs-client.service
+++ b/src/packaging/RedHat/openafs-client.service
@@ -7,6 +7,7 @@ Type=forking
EnvironmentFile=/etc/sysconfig/openafs
ExecStartPre=/sbin/modprobe openafs
ExecStart=/usr/sbin/afsd $AFSD_ARGS $CACHE $OPTIONS $CONFDIR
+ExecStartPost=/usr/libexec/openafs/sysnames
ExecStop=/bin/umount /afs
ExecStop=/usr/sbin/afsd -shutdown
ExecStop=/sbin/rmmod libafs
--
1.7.11.7
openafs-1.6.1-systemd-fhs.patch:
openafs-client.service | 4 ++--
openafs-server.service | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
--- NEW FILE openafs-1.6.1-systemd-fhs.patch ---
From 5c440cbf1c57bb22e7ebbeaf164f52e68377252f Mon Sep 17 00:00:00 2001
From: Ken Dreyer <ktdreyer(a)ktdreyer.com>
Date: Mon, 8 Oct 2012 20:58:13 -0600
Subject: [PATCH 3/5] systemd: use FHS-style paths
The unit files from
openafs.org still refer to the old transarc paths.
Replace them with FHS-compliant paths.
Change-Id: Iff326d082a00e3632ff7a8c9983fbf277ce6b4eb
---
src/packaging/RedHat/openafs-client.service | 4 ++--
src/packaging/RedHat/openafs-server.service | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/packaging/RedHat/openafs-client.service
b/src/packaging/RedHat/openafs-client.service
index a5fb287..89a344f 100644
--- a/src/packaging/RedHat/openafs-client.service
+++ b/src/packaging/RedHat/openafs-client.service
@@ -6,9 +6,9 @@ After=syslog.target network.target
Type=forking
EnvironmentFile=/etc/sysconfig/openafs
ExecStartPre=/sbin/modprobe openafs
-ExecStart=/usr/vice/etc/afsd $AFSD_ARGS
+ExecStart=/usr/sbin/afsd $AFSD_ARGS
ExecStop=/bin/umount /afs
-ExecStop=/usr/vice/etc/afsd -shutdown
+ExecStop=/usr/sbin/afsd -shutdown
ExecStop=/sbin/rmmod libafs
KillMode=none
diff --git a/src/packaging/RedHat/openafs-server.service
b/src/packaging/RedHat/openafs-server.service
index 2d34bb0..6f6a26f 100644
--- a/src/packaging/RedHat/openafs-server.service
+++ b/src/packaging/RedHat/openafs-server.service
@@ -4,7 +4,7 @@ After=syslog.target network.target
[Service]
EnvironmentFile=-/etc/sysconfig/openafs
-ExecStart=/usr/afs/bin/bosserver $BOSSERVER_ARGS
+ExecStart=/usr/bin/bosserver $BOSSERVER_ARGS
ExecStop=/usr/bin/bos shutdown localhost -wait -localauth
[Install]
--
1.7.11.7
openafs-1.6.1-systemd-kmod-name.patch:
openafs-client.service | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- NEW FILE openafs-1.6.1-systemd-kmod-name.patch ---
From 1c4448380cae1da4302ec8b74bb74945b692aa70 Mon Sep 17 00:00:00 2001
From: Ken Dreyer <ktdreyer(a)ktdreyer.com>
Date: Mon, 8 Oct 2012 20:55:50 -0600
Subject: [PATCH 2/5] systemd: unload module "libafs"
Load the module as "openafs", but unload it using the name "libafs".
Change-Id: Ib7d3d9b80ff58e9cded9a3171a5b003f1995a5b7
---
src/packaging/RedHat/openafs-client.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/packaging/RedHat/openafs-client.service
b/src/packaging/RedHat/openafs-client.service
index 2ee652a..a5fb287 100644
--- a/src/packaging/RedHat/openafs-client.service
+++ b/src/packaging/RedHat/openafs-client.service
@@ -9,7 +9,7 @@ ExecStartPre=/sbin/modprobe openafs
ExecStart=/usr/vice/etc/afsd $AFSD_ARGS
ExecStop=/bin/umount /afs
ExecStop=/usr/vice/etc/afsd -shutdown
-ExecStop=/sbin/rmmod openafs
+ExecStop=/sbin/rmmod libafs
KillMode=none
[Install]
--
1.7.11.7
openafs-1.6.1-systemd-no-cellservdb.patch:
openafs-client.service | 3 ---
1 file changed, 3 deletions(-)
--- NEW FILE openafs-1.6.1-systemd-no-cellservdb.patch ---
From 9ed4e76885f2a315586bf32b3106de86c32c5daa Mon Sep 17 00:00:00 2001
From: Ken Dreyer <ktdreyer(a)ktdreyer.com>
Date: Mon, 8 Oct 2012 20:55:12 -0600
Subject: [PATCH 1/5] systemd: skip CellServDB manipulation
Change-Id: I23544f183c0423b208b6465c8d7184d64b6b4a15
---
src/packaging/RedHat/openafs-client.service | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/packaging/RedHat/openafs-client.service
b/src/packaging/RedHat/openafs-client.service
index 936762e..2ee652a 100644
--- a/src/packaging/RedHat/openafs-client.service
+++ b/src/packaging/RedHat/openafs-client.service
@@ -5,8 +5,6 @@ After=syslog.target network.target
[Service]
Type=forking
EnvironmentFile=/etc/sysconfig/openafs
-ExecStartPre=/bin/sed -n 'w/usr/vice/etc/CellServDB'
/usr/vice/etc/CellServDB.local /usr/vice/etc/CellServDB.dist
-ExecStartPre=/bin/chmod 0644 /usr/vice/etc/CellServDB
ExecStartPre=/sbin/modprobe openafs
ExecStart=/usr/vice/etc/afsd $AFSD_ARGS
ExecStop=/bin/umount /afs
--
1.7.11.7
--- NEW FILE sysnames ---
#!/bin/bash
# /usr/libexec/openafs/sysnames
# Set custom sysnames after starting the afsd service.
# Runs as "ExecStartPost" in openafs-client.service.
# Figure out what we are
_ARCH=`uname -i | sed 's/x86_64/amd64/'`
_KERN=`uname -r | sed 's/\([0-9]\+\)\.\([0-9]\+\)\..*/\1\2/'`
_DIST=""
for d in fedora centos redhat ; do
if [ -f "/etc/$d-release" ] ; then
_DIST=$d
break
fi
done
# What version of the distribution are we? Cut off the Client|Server
# mess from RHEL
_REL=`/bin/rpm -qf --qf '%{version}\n' /etc/${_DIST}-release | sed
's/\([0-9]\+\)[a-zA-Z]\+/\1/'`
# Sysname list. The order here is from specific to general, with a
# fallback to the compiled-in value from /usr/bin/sys. This will be
# used as the sysname search path.
SYSNAMELIST="${_ARCH}_${_DIST}_${_REL} ${_ARCH}_linux${_KERN} $(/usr/bin/sys)"
# Set the sysname
if [ -n "$SYSNAMELIST" ] ; then
_FLAG=0
_CMD=""
for SYSNAME in $SYSNAMELIST ; do
if [ $_FLAG == "1" ] ; then
_CMD="$_CMD -newsys $SYSNAME"
else
_FLAG=1
_CMD="/usr/bin/fs sysname $SYSNAME"
fi
done
fi
$_CMD > /dev/null
Index: openafs.spec
===================================================================
RCS file: /cvs/free/rpms/openafs/devel/openafs.spec,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- openafs.spec 24 Aug 2012 16:57:08 -0000 1.28
+++ openafs.spec 9 Oct 2012 06:01:35 -0000 1.29
@@ -13,7 +13,7 @@
Summary: Enterprise Network File System
Name: openafs
Version: 1.6.1
-Release: 5%{?dist}
+Release: 6%{?dist}
License: IBM
Group: System Environment/Daemons
URL:
http://www.openafs.org
@@ -23,6 +23,10 @@
Source12: cacheinfo
Source13: openafs.init
Source14: afs.conf
+# Similar to afs.conf, but for systemd.
+Source15: afs.conf.systemd
+# Sysnames helper script
+Source16: sysnames
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: krb5-devel, pam-devel, ncurses-devel, flex, byacc, bison
@@ -34,6 +38,22 @@
# Upstream patch to compile with newer glibc
# (not yet on openafs-stable-1_6_x; cherry-picked from master)
Patch2: openafs-1.6.1-afsd-sys-resource-h.patch
+# systemd: Skip CellServDB manipulation
+Patch3: openafs-1.6.1-systemd-no-cellservdb.patch
+# systemd: unload the proper kernel module
+# (TODO: check if this can be upstreamed)
+Patch4: openafs-1.6.1-systemd-kmod-name.patch
+# systemd: use FHS-style paths instead of transarc paths
+Patch5: openafs-1.6.1-systemd-fhs.patch
+# systemd: add additional user-friendly environment vars
+Patch6: openafs-1.6.1-systemd-env-vars.patch
+# Add ExecPostStart "sysnames" helper script.
+Patch7: openafs-1.6.1-systemd-execpoststart.patch
+
+# Use systemd unit files on Fedora 18 and above.
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+ %global _with_systemd 1
+%endif
%description
@@ -49,7 +69,14 @@
%package client
Summary: OpenAFS Filesystem client
Group: System Environment/Daemons
-Requires(post): bash, coreutils, chkconfig, selinux-policy-targeted
+Requires(post): bash, coreutils, selinux-policy-targeted
+%if 0%{?_with_systemd}
+Requires(preun): systemd
+Requires(postun): systemd
+Requires(post): systemd
+%else
+Requires(post): chkconfig
+%endif
Requires: %{name}-kmod >= %{version}
Requires: openafs = %{version}
Provides: %{name}-kmod-common = %{version}
@@ -86,6 +113,11 @@
Summary: OpenAFS Filesystem Server
Group: System Environment/Daemons
Requires: openafs-client = %{version}, openafs = %{version}
+%if 0%{?_with_systemd}
+Requires(preun): systemd
+Requires(postun): systemd
+Requires(post): systemd
+%endif
%description server
The AFS distributed filesystem. AFS is a distributed filesystem
@@ -109,6 +141,13 @@
# This allows us to build with newer glibc
%patch2 -p1
+# systemd unit file changes for RPM Fusion
+%patch3 -p1 -b .cellservdb
+%patch4 -p1 -b .kmod
+%patch5 -p1 -b .fhs
+%patch6 -p1 -b .envvars
+%patch7 -p1 -b .execpoststart
+
# Convert the licese to UTF-8
mv src/LICENSE src/LICENSE~
iconv -f ISO-8859-1 -t UTF8 src/LICENSE~ > src/LICENSE
@@ -156,13 +195,32 @@
install -p -m 644 %{SOURCE12} ${RPM_BUILD_ROOT}%{_sysconfdir}/openafs
echo %{thiscell} > ${RPM_BUILD_ROOT}%{_sysconfdir}/openafs/ThisCell
-# install the init script
-mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d
-install -m 755 %{SOURCE13} ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d/openafs
+# install the init file(s)
+%if 0%{?_with_systemd}
+ # install systemd service files
+ mkdir -p ${RPM_BUILD_ROOT}%{_unitdir}
+ pushd src/packaging/RedHat
+ install -p -m 644 openafs-client.service \
+ ${RPM_BUILD_ROOT}%{_unitdir}/openafs-client.service
+ install -p -m 644 openafs-server.service \
+ ${RPM_BUILD_ROOT}%{_unitdir}/openafs-server.service
+ popd
+ # install "sysnames" helper script
+ install -p -m 755 %{SOURCE16} \
+ ${RPM_BUILD_ROOT}%{_libexecdir}/openafs/sysnames
+%else
+ # install legacy SysV init script
+ mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d
+ install -m 755 %{SOURCE13} ${RPM_BUILD_ROOT}%{_sysconfdir}/rc.d/init.d/openafs
+%endif
# sysconfig file
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
-install -m 644 %{SOURCE14} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/openafs
+%if 0%{?_with_systemd}
+ install -m 644 %{SOURCE15} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/openafs
+%else
+ install -m 644 %{SOURCE14} ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/openafs
+%endif
# Include the vlclient binary
install -m 755 src/vlserver/vlclient ${RPM_BUILD_ROOT}/usr/sbin/vlclient
@@ -210,11 +268,18 @@
# don't restart in post because kernel modules could well have changed
%post
/sbin/ldconfig
-if [ $1 = 1 ]; then
+%if 0%{?_with_systemd}
+ # systemd unit files are in the -client and -server subpackages.
+%else
+ if [ $1 = 1 ]; then
/sbin/chkconfig --add openafs
-fi
+ fi
+%endif
%post client
+%if !0%{?_with_systemd}
+ %systemd_post openafs-client.service
+%endif
# if this is owned by the package, upgrades with afs running can't work
if [ ! -d /afs ] ; then
mkdir -m 700 /afs
@@ -222,15 +287,44 @@
fi
exit 0
+%post server
+%if !0%{?_with_systemd}
+ %systemd_post openafs-server.service
+%endif
+
%preun
-if [ "$1" = 0 ] ; then
+%if 0%{?_with_systemd}
+ # systemd unit files are in the -client and -server subpackages.
+%else
+ if [ "$1" = 0 ] ; then
/sbin/chkconfig --del openafs
%{_sysconfdir}/rc.d/init.d/openafs stop && rmdir /afs
-fi
-exit 0
+ fi
+ exit 0
+%endif
+
+%preun client
+%if 0%{?_with_systemd}
+ %systemd_preun openafs-client.service
+%endif
+
+%preun server
+%if 0%{?_with_systemd}
+ %systemd_preun openafs-server.service
+%endif
%postun -p /sbin/ldconfig
+%postun client
+%if 0%{?_with_systemd}
+ %systemd_postun openafs-client.service
+%endif
+
+%postun server
+%if 0%{?_with_systemd}
+ %systemd_postun openafs-server.service
+%endif
+
%post devel -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig
@@ -240,10 +334,16 @@
%files
%defattr(-, root, root, -)
+%dir %{_sysconfdir}/openafs
+%dir %{_libexecdir}/openafs
%doc src/LICENSE README NEWS README.DEVEL README.GIT README.PTHREADED_UBIK
%doc README.WARNINGS README-WINDOWS
%config(noreplace) %{_sysconfdir}/sysconfig/*
+%if 0%{?_with_systemd}
+# systemd files are in -client and -server subpackages
+%else
%{_sysconfdir}/rc.d/init.d/*
+%endif
%{_bindir}/aklog
%{_bindir}/bos
%{_bindir}/fs
@@ -281,11 +381,14 @@
%files client
%defattr(-, root, root)
-%dir %{_sysconfdir}/openafs
%dir %{_localstatedir}/cache/openafs
%config(noreplace) %{_sysconfdir}/openafs/CellServDB
%config(noreplace) %{_sysconfdir}/openafs/ThisCell
%config(noreplace) %{_sysconfdir}/openafs/cacheinfo
+%if 0%{?_with_systemd}
+%{_unitdir}/openafs-client.service
+%{_libexecdir}/openafs/sysnames
+%endif
%{_bindir}/afsio
%{_bindir}/cmdebug
%{_bindir}/xstat_cm_test
@@ -293,12 +396,27 @@
%files server
%defattr(-,root,root)
+%if 0%{?_with_systemd}
+%{_unitdir}/openafs-server.service
+%endif
%{_bindir}/afsmonitor
%{_bindir}/asetkey
%{_bindir}/scout
%{_bindir}/udebug
%{_bindir}/xstat_fs_test
-%{_libexecdir}/openafs
+%{_libexecdir}/openafs/buserver
+%{_libexecdir}/openafs/dafileserver
+%{_libexecdir}/openafs/dasalvager
+%{_libexecdir}/openafs/davolserver
+%{_libexecdir}/openafs/fileserver
+%{_libexecdir}/openafs/kaserver
+%{_libexecdir}/openafs/ptserver
+%{_libexecdir}/openafs/salvager
+%{_libexecdir}/openafs/salvageserver
+%{_libexecdir}/openafs/upclient
+%{_libexecdir}/openafs/upserver
+%{_libexecdir}/openafs/vlserver
+%{_libexecdir}/openafs/volserver
%{_sbindir}/dafssync-debug
%{_sbindir}/fssync-debug
%{_sbindir}/salvsync-debug
@@ -337,6 +455,9 @@
%{_datadir}/openafs/C/afszcm.cat
%changelog
+* Mon Oct 8 2012 Ken Dreyer <ktdreyer(a)ktdreyer.com> 0:1.6.1-6
+- Enable systemd unit files for F18 and above
+
* Thu Aug 23 2012 Jack Neely <jjneely(a)ncsu.edu> 0:1.6.1-5
- Update /etc/sysconfig/openafs to have some more current
default settings.