1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit autotools eutils flag-o-matic multilib pam systemd toolchain-funcs versionator
9 MY_PV=$(delete_version_separator '_')
13 DESCRIPTION="The OpenAFS distributed file system"
14 HOMEPAGE="http://www.openafs.org/"
15 # We always d/l the doc tarball as man pages are not USE=doc material
16 [[ ${PV} == *_pre* ]] && MY_PRE="candidate/" || MY_PRE=""
18 http://openafs.org/dl/openafs/${MY_PRE}${MY_PV}/${MY_P}-src.tar.bz2
19 http://openafs.org/dl/openafs/${MY_PV}/${MY_P}-doc.tar.bz2
20 https://dev.gentoo.org/~bircoph/afs/${PN}-patches-${PVER}.tar.xz
23 LICENSE="IBM BSD openafs-krb5-a APSL-2"
25 KEYWORDS="~amd64 ~amd64-fbsd ~amd64-linux ~sparc ~x86 ~x86-fbsd ~x86-linux"
27 IUSE="doc kerberos +modules pam"
32 kerberos? ( virtual/krb5 )"
36 app-text/docbook-xsl-stylesheets
41 modules? ( ~net-fs/openafs-kernel-${PV} )"
43 S="${WORKDIR}/${MY_P}"
46 EPATCH_EXCLUDE="050_all_job_server.patch" \
47 EPATCH_SUFFIX="patch" \
48 epatch "${WORKDIR}"/gentoo/patches
51 # fixing 2-nd level makefiles to honor flags
52 sed -i -r 's/\<CFLAGS[[:space:]]*=/CFLAGS+=/; s/\<LDFLAGS[[:space:]]*=/LDFLAGS+=/' \
53 src/*/Makefile.in || die '*/Makefile.in sed failed'
55 # packaging is f-ed up, so we can't run eautoreconf
56 # run autotools commands based on what is listed in regen.sh
59 eautoconf -o configure-libafs configure-libafs.ac
61 einfo "Deleting autom4te.cache directory"
68 --disable-kernel-module \
69 --disable-strip-binaries \
70 --enable-supergroups \
72 $(use_with doc html-xsl /usr/share/sgml/docbook/xsl-stylesheets/html/chunk.xsl) \
73 $(use_with kerberos krb5)
80 for d in doc/xml/{AdminGuide,QuickStartUnix,UserGuide}; do
87 local OPENRCDIR="${WORKDIR}/gentoo/openrc"
88 local SYSTEMDDIR="${WORKDIR}/gentoo/systemd"
90 emake DESTDIR="${ED}" install_nolibafs
93 doins src/afsd/CellServDB
94 echo "/afs:/var/cache/openafs:200000" > "${ED}"/etc/openafs/cacheinfo
95 echo "openafs.org" > "${ED}"/etc/openafs/ThisCell
97 # pam_afs and pam_afs.krb have been installed in irregular locations, fix
99 dopammod "${ED}"/usr/$(get_libdir)/pam_afs*
101 rm -f "${ED}"/usr/$(get_libdir)/pam_afs* || die
103 # remove kdump stuff provided by kexec-tools #222455
104 rm -rf "${ED}"/usr/sbin/kdump*
106 # avoid collision with mit_krb5's version of kpasswd
107 mv "${ED}"/usr/bin/kpasswd{,_afs} || die
108 mv "${ED}"/usr/share/man/man1/kpasswd{,_afs}.1 || die
110 # move lwp stuff around #200674 #330061
111 mv "${ED}"/usr/include/{lwp,lock,timer}.h "${ED}"/usr/include/afs/ || die
112 mv "${ED}"/usr/$(get_libdir)/liblwp* "${ED}"/usr/$(get_libdir)/afs/ || die
113 # update paths to the relocated lwp headers
115 -e '/^#include <(lwp|lock|timer).h>/s:<([^>]*)>:<afs/\1>:' \
116 "${ED}"/usr/include/*.h \
117 "${ED}"/usr/include/*/*.h \
120 # minimal documentation
121 use pam && doman src/pam/pam_afs.5
122 dodoc "${WORKDIR}/gentoo/README" src/afsd/CellServDB
124 # documentation package
126 dodoc -r doc/{arch,examples,protocol,txt}
130 # Gentoo related scripts
131 newinitd "${OPENRCDIR}"/openafs-client.initd openafs-client
132 newconfd "${OPENRCDIR}"/openafs-client.confd openafs-client
133 newinitd "${OPENRCDIR}"/openafs-server.initd openafs-server
134 newconfd "${OPENRCDIR}"/openafs-server.confd openafs-server
135 systemd_dotmpfilesd "${SYSTEMDDIR}"/tmpfiles.d/openafs-client.conf
136 systemd_dounit "${SYSTEMDDIR}"/openafs-client.service
137 systemd_dounit "${SYSTEMDDIR}"/openafs-server.service
139 # used directories: client
142 # used directories: server
143 keepdir /etc/openafs/server
145 keepdir /var/lib/openafs
146 keepdir /var/lib/openafs/db
148 keepdir /var/lib/openafs/logs
150 # link logfiles to /var/log
151 dosym ../lib/openafs/logs /var/log/openafs
155 ## Somewhat intelligently install default configuration files
156 ## (when they are not present)
158 for x in cacheinfo CellServDB ThisCell ; do
159 if [ -e "${EROOT}"/etc/openafs/${x} ] ; then
160 cp "${EROOT}"/etc/openafs/${x} "${ED}"/etc/openafs/
166 elog "This installation should work out of the box (at least the"
167 elog "client part doing global afs-cell browsing, unless you had"
168 elog "a previous and different configuration). If you want to"
169 elog "set up your own cell or modify the standard config,"
170 elog "please have a look at the Gentoo OpenAFS documentation"
171 elog "(warning: it is not yet up to date wrt the new file locations)"
173 elog "The documentation can be found at:"
174 elog " https://wiki.gentoo.org/wiki/OpenAFS"