- From a5864c9a7cb46803fc193d4cf6d1119b98770a13 Mon Sep 17 00:00:00 2001
- From: Roland Mainz <roland.mainz@nrubsig.org>
- Date: Fri, 19 Apr 2024 17:06:42 +0200
- Subject: [PATCH] cygwin: RFE: Add a Windows service
- ("ms-nfs41-client-service") for "nfsd_debug"
- RFE: Add a Windows service ("ms-nfs41-client-service") for
- "nfsd_debug.exe", "disabled" by default.
- The service is implemented via Cygwin cygrunsrv, and calls the
- $ /sbin/msnfs41client run_daemon # script.
- ** Usage (as Adminstrator):
- $ sc start ms-nfs41-client-service
- ** Notes:
- - requires "Adminstrator" account, and one nfsd client daemon is
- used for all users on a machine.
- - The "ms-nfs41-client-service" service is installed by default as
- "disabled" and therefore always requires a "manual" start (e.g.
- $ sc start ms-nfs41-client-service #)
- - note that DOS devices are virtualised per LSA Logon, so each Logon
- needs to do a separare nfs_mount.exe to mount a NFSv4 share
- - nfsd_debug.exe will run as user "SYSTEM", but will do user
- impersonation for each request
- - stopping the service will NOT unmount filesystems, and due to a
- bug a reboot is required to restart and mount any NFSv4
- filesystems again
- ** Administration:
- - Follow new log messages:
- $ tail -f '/var/log/ms-nfs41-client-service.log'
- - Query service status:
- $ sc queryex ms-nfs41-client-service
- - Query service config:
- $ sc qc ms-nfs41-client-service
- - Start service automatically:
- (nfsd_debug.exe will be started automagically, but mounts are
- not restored):
- $ sc config ms-nfs41-client-service start=auto
- - Start service manually (default):
- $ sc config ms-nfs41-client-service start=disabled
- Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
- ---
- cygwin/README.bintarball.txt | 39 ++++++++++++++++++++++++++++++++-
- cygwin/devel/msnfs41client.bash | 38 ++++++++++++++++++++++++++++----
- 2 files changed, 72 insertions(+), 5 deletions(-)
- diff --git a/cygwin/README.bintarball.txt b/cygwin/README.bintarball.txt
- index c0c2bf3..9e94ddd 100644
- --- a/cygwin/README.bintarball.txt
- +++ b/cygwin/README.bintarball.txt
- @@ -129,7 +129,44 @@ $ (set -o xtrace ; cd / && tar -tf ~/download/${bintarball.base_filename}.tar.bz
- # 7. Usage:
- #
- -# Run the NFSv4 client daemon:
- +# Option a)
- +# * Start NFSv4 client daemon as Windows service (requires
- +# "Adminstrator" account):
- +
- +$ sc start ms-nfs41-client-service
- +
- +# * Notes:
- +# - requires "Adminstrator" account, and one nfsd client daemon is
- +# used for all users on a machine.
- +# - The "ms-nfs41-client-service" service is installed by default as
- +# "disabled" and therefore always requires a "manual" start (e.g.
- +# $ sc start ms-nfs41-client-service #)
- +# - note that DOS devices are virtualised per LSA Logon, so each Logon
- +# needs to do a separare nfs_mount.exe to mount a NFSv4 share
- +# - nfsd_debug.exe will run as user "SYSTEM", but will do user
- +# impersonation for each request
- +# - stopping the service will NOT unmount filesystems, and due to a
- +# bug a reboot is required to restart and mount any NFSv4
- +# filesystems again
- +
- +# * Administration:
- +# - Follow new log messages:
- +$ tail -f '/var/log/ms-nfs41-client-service.log'
- +# - Query service status:
- +$ sc queryex ms-nfs41-client-service
- +# - Query service config:
- +$ sc qc ms-nfs41-client-service
- +# - Start service automatically:
- +# (nfsd_debug.exe will be started automagically, but mounts are
- +# not restored):
- +$ sc config ms-nfs41-client-service start=auto
- +# - Start service manually (default):
- +$ sc config ms-nfs41-client-service start=disabled
- +
- +
- +# Option b)
- +# Run the NFSv4 client daemon manually:
- +#
- # - run this preferably as "Administrator", but this is not a requirement
- # - requires separate terminal
- $ /sbin/msnfs41client run_daemon
- diff --git a/cygwin/devel/msnfs41client.bash b/cygwin/devel/msnfs41client.bash
- index 066a4fa..1325d6f 100644
- --- a/cygwin/devel/msnfs41client.bash
- +++ b/cygwin/devel/msnfs41client.bash
- @@ -123,6 +123,32 @@ function nfsclient_install
- openfiles /local ON
- + #
- + # install "msnfs41client run_daemon" as system service
- + # 'ms-nfs41-client-service'
- + # "off" by default, requires manual starting
- + #
- +
- + # remove 'ms-nfs41-client-service'
- + sc stop 'ms-nfs41-client-service' || true
- + cygrunsrv --remove 'ms-nfs41-client-service' || true
- + if [[ -f '/var/log/ms-nfs41-client-service.log' ]] ; then
- + mv \
- + '/var/log/ms-nfs41-client-service.log' \
- + "/var/log/ms-nfs41-client-service.log.old$(date +%Y%m%d_%Hh%Mm)"
- + fi
- +
- + # install new 'ms-nfs41-client-service'
- + cygrunsrv --install \
- + 'ms-nfs41-client-service' \
- + --path "$PWD/msnfs41client" \
- + --args 'run_daemon' \
- + --type 'manual' \
- + --chdir "$PWD"
- +
- + # query new 'ms-nfs41-client-service'
- + sc query 'ms-nfs41-client-service'
- +
- # check whether the driver really has been installed
- md5sum \
- "$PWD/nfs41_driver.sys" \
- @@ -135,13 +161,15 @@ function nfsclient_install
- function nfsclient_rundeamon
- {
- - set -o xtrace
- set -o nounset
- - printf '# uname='%s' isadmin=%d\n' \
- + printf '# user='%s' uname='%s' isadmin=%d\n' \
- + "$(id -u -n)" \
- "$(uname -a)" \
- "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
- + set -o xtrace
- +
- typeset -a nfsd_args=(
- 'nfsd_debug.exe'
- '-d' '0'
- @@ -226,13 +254,15 @@ function nfsclient_rundeamon
- function nfsclient_system_rundeamon
- {
- - set -o xtrace
- set -o nounset
- - printf '# uname='%s' isadmin=%d\n' \
- + printf '# user='%s' uname='%s' isadmin=%d\n' \
- + "$(id -u -n)" \
- "$(uname -a)" \
- "$(is_windows_admin_account ; printf "%d\n" $((${?}?0:1)))"
- + set -o xtrace
- +
- typeset -a nfsd_args=(
- 'nfsd_debug.exe'
- '-d' '0'
- --
- 2.43.0
msnfs41client: Patch to add a Win32 "ms-nfs41-client-service", 2024-04-19
Posted by Anonymous on Fri 19th Apr 2024 16:27
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.