From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] mkinitcpio-nfs-utils: support NFSv4 roots
Date: Tue, 10 Jan 2023 18:24:36 +0100 [thread overview]
Message-ID: <20230110172436.3fQl2WhB5U1Mni-s8cxtLaOy6TvoDkQPEBody9w5nys@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-41560@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 799 bytes --]
There is an updated pull request by ahesford against master on the void-packages repository
https://github.com/ahesford/void-packages nfsroot
https://github.com/void-linux/void-packages/pull/41560
mkinitcpio-nfs-utils: support NFSv4 roots
The `net` hook for `mkinitcpio` shipped by this package uses a helper to do v2 or v3 mounts that support locking without the need for a local `lockd` in the initramfs. The helper does not support v4 mounts and v4 does not require a local `lockd`, so we can look for an NFS version requirement in the root spec and directly call `mount -t nfs4` instead of `nfsmount` to support v4 roots.
#### Testing the changes
- I tested the changes in this PR: **in progress**
A patch file from https://github.com/void-linux/void-packages/pull/41560.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-nfsroot-41560.patch --]
[-- Type: text/x-diff, Size: 4040 bytes --]
From be4d7313fdcb850f5922053d3e43258217281078 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 10 Jan 2023 10:57:51 -0500
Subject: [PATCH] mkinitcpio-nfs-utils: support NFSv4 roots, fix installation
---
.../files/initcpio-hook-net | 13 ++++++-
.../files/initcpio-install-net | 2 ++
srcpkgs/mkinitcpio-nfs-utils/template | 35 ++++++++++---------
3 files changed, 32 insertions(+), 18 deletions(-)
diff --git a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
index 4d1ebb95605e..33382d95b728 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
+++ b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
@@ -84,7 +84,18 @@ nfs_mount_handler() {
launch_interactive_shell
msg "Trying to continue (this will most likely fail) ..."
fi
- nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
+
+ # nfsmount avoids problems with lockd for v2 and v3 but does not support v4;
+ # to support v4 roots, examine mount options for a v4 version spec and use
+ # the ordinary mount program. v4 doesn't need lockd for file locking anyway.
+ mount_cmd=nfsmount
+ case "${nfs_option}" in
+ nfsvers=4*|*,nfsvers=4*|vers=4*|*,vers=4*)
+ command -v mount.nfs4 >/dev/null 2>&1 && mount_cmd="mount -t nfs4"
+ ;;
+ esac
+
+ ${mount_cmd} ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
}
# vim: set ft=sh ts=4 sw=4 et:
diff --git a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
index 79b678949c95..153767add8c5 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
+++ b/srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
@@ -3,9 +3,11 @@
build() {
add_checked_modules '/drivers/net/'
add_module nfsv3?
+ add_module nfsv4?
add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"
add_binary "/usr/lib/initcpio/nfsmount" "/bin/nfsmount"
+ command -v mount.nfs4 >/dev/null 2>&1 && add_binary "mount.nfs4"
add_runscript
}
diff --git a/srcpkgs/mkinitcpio-nfs-utils/template b/srcpkgs/mkinitcpio-nfs-utils/template
index 7f36e1cf7fdf..75b8565158ac 100644
--- a/srcpkgs/mkinitcpio-nfs-utils/template
+++ b/srcpkgs/mkinitcpio-nfs-utils/template
@@ -1,7 +1,7 @@
# Template file for 'mkinitcpio-nfs-utils'
pkgname=mkinitcpio-nfs-utils
version=0.3
-revision=3
+revision=4
build_style=gnu-makefile
depends="mkinitcpio"
short_desc="Ipconfig and nfsmount tools for NFS root support in mkinitcpio"
@@ -11,26 +11,27 @@ homepage="http://www.archlinux.org/"
distfiles="https://sources.archlinux.org/other/mkinitcpio/$pkgname-$version.tar.xz"
checksum=d290d489844fae100ca7b848b8eef40078124ff373203086bacc07329d1e8939
-case "$XBPS_TARGET_MACHINE" in
-*-musl)
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ # musl doesn't set this
CFLAGS="-DSYS_NMLN=65"
- # http://osxr.org/glibc/source/sysdeps/unix/sysv/linux/bits/utsname.h?v=glibc-2.15; fixes musl not having set this variable
- ;;
-esac
+fi
+post_patch() {
+ vsed -i '/CC.*-o/s/$/ $(LDFLAGS)/' */Makefile
-post_extract() {
- sed -i '/CC.*-o/s/$/ $(LDFLAGS)/' */Makefile
+ # No RPC in musl for now
+ if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ vsed -i 's|PROGRAMS = ipconfig nfsmount|PROGRAMS = ipconfig|g' Makefile
+ fi
}
-pre_configure() {
- case "$XBPS_TARGET_MACHINE" in
- *-musl)
- sed -i 's|PROGRAMS = ipconfig nfsmount|PROGRAMS = ipconfig|g' Makefile
- # No RPC in musl for now
- ;;
- esac
-}
-post_install() {
+
+do_install() {
+ # Makefile installation is broken, just install the two executables directly
+ vinstall ipconfig/ipconfig 755 usr/lib/initcpio
+ if [ "$XBPS_TARGET_LIBC" != "musl" ]; then
+ vinstall nfsmount/nfsmount 755 usr/lib/initcpio
+ fi
+
vinstall ${FILESDIR}/initcpio-install-net 644 usr/lib/initcpio/install net
vinstall ${FILESDIR}/initcpio-hook-net 644 usr/lib/initcpio/hooks net
}
next prev parent reply other threads:[~2023-01-10 17:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 16:00 [PR PATCH] " ahesford
2023-01-10 17:24 ` ahesford [this message]
2023-01-10 18:04 ` [PR PATCH] [Updated] " ahesford
2023-01-11 2:35 ` [PR PATCH] [Merged]: " ahesford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230110172436.3fQl2WhB5U1Mni-s8cxtLaOy6TvoDkQPEBody9w5nys@z \
--to=ahesford@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).