diff --git a/core/nfs-utils/0001-32-bit-compat.patch b/core/nfs-utils/0001-32-bit-compat.patch new file mode 100644 index 000000000..bef5a3c24 --- /dev/null +++ b/core/nfs-utils/0001-32-bit-compat.patch @@ -0,0 +1,106 @@ +From 878ac385d867c008cca292ed11e073e72ce38ccb Mon Sep 17 00:00:00 2001 +From: Kevin Mihelich +Date: Wed, 15 May 2019 17:26:29 -0600 +Subject: [PATCH] 32-bit compat + +--- + utils/nfsdcld/sqlite.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c +index faa62f94..8563fbe9 100644 +--- a/utils/nfsdcld/sqlite.c ++++ b/utils/nfsdcld/sqlite.c +@@ -535,7 +535,7 @@ sqlite_copy_cltrack_records(int *num_rec) + xlog(L_ERROR, "Unable to begin transaction: %s", err); + goto rollback; + } +- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\";", ++ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016llx\";", + current_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -550,7 +550,7 @@ sqlite_copy_cltrack_records(int *num_rec) + xlog(L_ERROR, "Unable to clear records from current epoch: %s", err); + goto rollback; + } +- ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%016lx\" " ++ ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%016llx\" " + "SELECT id FROM attached.clients;", + current_epoch); + if (ret < 0) { +@@ -703,7 +703,7 @@ sqlite_insert_client(const unsigned char *clname, const size_t namelen) + int ret; + sqlite3_stmt *stmt = NULL; + +- ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%016lx\" " ++ ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%016llx\" " + "VALUES (?);", current_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -748,7 +748,7 @@ sqlite_remove_client(const unsigned char *clname, const size_t namelen) + int ret; + sqlite3_stmt *stmt = NULL; + +- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\" " ++ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016llx\" " + "WHERE id==?;", current_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -798,7 +798,7 @@ sqlite_check_client(const unsigned char *clname, const size_t namelen) + int ret; + sqlite3_stmt *stmt = NULL; + +- ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%016lx\" " ++ ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%016llx\" " + "WHERE id==?;", recovery_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -873,7 +873,7 @@ sqlite_grace_start(void) + tcur++; + + ret = snprintf(buf, sizeof(buf), "UPDATE grace " +- "SET current = %ld, recovery = %ld;", ++ "SET current = %lld, recovery = %lld;", + (int64_t)tcur, (int64_t)trec); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -891,7 +891,7 @@ sqlite_grace_start(void) + goto rollback; + } + +- ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%016lx\" " ++ ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%016llx\" " + "(id BLOB PRIMARY KEY);", + tcur); + if (ret < 0) { +@@ -915,7 +915,7 @@ sqlite_grace_start(void) + * values in the grace table, just clear out the records for + * the current reboot epoch. + */ +- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\";", ++ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016llx\";", + tcur); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -976,7 +976,7 @@ sqlite_grace_done(void) + goto rollback; + } + +- ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%016lx\";", ++ ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%016llx\";", + recovery_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +@@ -1027,7 +1027,7 @@ sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *c + return -EINVAL; + } + +- ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%016lx\";", ++ ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%016llx\";", + recovery_epoch); + if (ret < 0) { + xlog(L_ERROR, "sprintf failed!"); +-- +2.21.0 + diff --git a/core/nfs-utils/PKGBUILD b/core/nfs-utils/PKGBUILD new file mode 100644 index 000000000..04665f06a --- /dev/null +++ b/core/nfs-utils/PKGBUILD @@ -0,0 +1,117 @@ +# Maintainer: AndyRTR +# Maintainer: Tobias Powalowski +# Contributor: John Proctor +# Contributor: dibblethewrecker +# Contributor: abelstr +# Contributor: Marco Lima + +# ALARM: Kevin Mihelich +# - patch to fix 32-bit FTBFS + +pkgbase=nfs-utils +pkgname=('nfs-utils' 'nfsidmap') +pkgver=2.3.4 +pkgrel=1 +arch=('x86_64') +url='http://nfs.sourceforge.net' +makedepends=('libevent' 'sqlite' 'rpcsvc-proto') +# http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=summary +source=(https://www.kernel.org/pub/linux/utils/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.{xz,sign} + id_resolver.conf + exports + 0001-32-bit-compat.patch) +# https://www.kernel.org/pub/linux/utils/nfs-utils/2.1.1/sha256sums.asc +sha256sums=('f8328ba386087a9926edd89f78a319ff55418a0e734dbf5f50350f465f0896cd' + 'SKIP' + 'ed31ae843cf66d3c262b39ed54533a861876231c5f5bb3811c0c498ac2ffa102' + '610715ed3daedc43b2536f541c7c57e138fb31eab5d837d9a6187a7403e30154' + 'a74d704d2b853400b26c261fdf880912d0645a1a592c1e69a9d86a6505ee1f1d') +validpgpkeys=('E1B71E339E20A10A676F7CB69AFB1D681A125177') # Steve Dickson + +prepare() { + cd ${pkgbase}-${pkgver} + + [[ $CARCH != "aarch64" ]] && patch -p1 -i ../0001-32-bit-compat.patch + + # fix hardcoded sbin path to our needs + sed -i "s|sbindir = /sbin|sbindir = /usr/bin|g" utils/*/Makefile.am + autoreconf -vfi +} + +build() { + cd ${pkgbase}-${pkgver} + ./configure --prefix=/usr \ + --sbindir=/usr/bin \ + --sysconfdir=/etc \ + --enable-gss \ + --without-tcp-wrappers \ + --with-statedir=/var/lib/nfs \ + --enable-ipv6 \ + --enable-libmount-mount \ + --enable-mountconfig \ + --with-start-statd=/usr/bin/start-statd + make +} + +check() { + cd ${pkgbase}-${pkgver} + make -k check || /bin/true +} + +package_nfs-utils() { + + pkgdesc="Support programs for Network File Systems" + license=('GPL2') + + backup=(etc/{exports,nfs.conf,nfsmount.conf}) + depends=('rpcbind' 'nfsidmap' 'gssproxy' 'libevent' 'device-mapper') + optdepends=('sqlite: for nfsdcltrack usage' + 'python: for nfsiostat and mountstats usage') + + cd ${pkgbase}-${pkgver} + make DESTDIR="$pkgdir" install + + install -D -m 644 utils/mount/nfsmount.conf "$pkgdir"/etc/nfsmount.conf + install -D -m 644 nfs.conf "$pkgdir"/etc/nfs.conf + + for i in systemd/{*.service,*.mount,*.target}; do + install -D -m 644 $i "$pkgdir"/usr/lib/systemd/system/$(basename $i) + done + install -d -m 755 "$pkgdir"/usr/share/doc/$pkgname + install -D -m 644 systemd/README "$pkgdir"/usr/share/doc/$pkgname/README.systemd + + # docs + install -m 644 {NEWS,README} "$pkgdir"/usr/share/doc/$pkgname/ + + # empty exports file + install -D -m 644 ../exports "$pkgdir"/etc/exports + + # config file for idmappers in newer kernels + install -D -m 644 ../id_resolver.conf "$pkgdir"/etc/request-key.d/id_resolver.conf + + mkdir "$pkgdir"/etc/exports.d + mkdir -m 555 "$pkgdir"/var/lib/nfs/rpc_pipefs + mkdir "$pkgdir"/var/lib/nfs/v4recovery + + # nfsidmap cleanup + rm -vrf $pkgdir/usr/include #/nfsid* + rm -vrf $pkgdir/usr/lib/libnfsidmap* + rm -vrf $pkgdir/usr/lib/pkgconfig #/libnfsidmap.pc + rm -v $pkgdir/usr/share/man/{man3/nfs4_uid_to_name*,man5/idmapd.conf*} + rm -rf $pkgdir/usr/share/man/man3 +} + +package_nfsidmap() { + + pkgdesc="Library to help mapping IDs, mainly for NFSv4" + license=('GPL2') + backup=(etc/idmapd.conf) + depends=('libldap') + + cd ${pkgbase}-${pkgver} + make -C support DESTDIR="$pkgdir" install + # config file + install -D -m 644 support/nfsidmap/idmapd.conf "$pkgdir"/etc/idmapd.conf + # license + install -Dm644 support/nfsidmap/COPYING $pkgdir/usr/share/licenses/nfsidmap/LICENSE +} diff --git a/core/nfs-utils/exports b/core/nfs-utils/exports new file mode 100644 index 000000000..59dfa2e7c --- /dev/null +++ b/core/nfs-utils/exports @@ -0,0 +1,12 @@ +# /etc/exports - exports(5) - directories exported to NFS clients +# +# Example for NFSv2 and NFSv3: +# /srv/home hostname1(rw,sync) hostname2(ro,sync) +# Example for NFSv4: +# /srv/nfs4 hostname1(rw,sync,fsid=0) +# /srv/nfs4/home hostname1(rw,sync,nohide) +# Using Kerberos and integrity checking: +# /srv/nfs4 *(rw,sync,sec=krb5i,fsid=0) +# /srv/nfs4/home *(rw,sync,sec=krb5i,nohide) +# +# Use `exportfs -arv` to reload. diff --git a/core/nfs-utils/id_resolver.conf b/core/nfs-utils/id_resolver.conf new file mode 100644 index 000000000..6b1ea483d --- /dev/null +++ b/core/nfs-utils/id_resolver.conf @@ -0,0 +1,9 @@ +# +# nfsidmap(5) - The NFS idmapper upcall program +# Summary: Used by NFSv4 to map user/group ids into +# user/group names and names into in ids +# Options: +# -v Increases the verbosity of the output to syslog +# -t timeout Set the expiration timer, in seconds, on the key +# +create id_resolver * * /usr/bin/nfsidmap %k %d