pastebin - collaborative debugging tool
rovema.kpaste.net RSS


msnfs41client.bash - simple Cygwin frontent for the msnfsv41 NFSv4.1 filesystem driver
Posted by Anonymous on Mon 4th Sep 2023 13:34
raw | new post
view followups (newest first): msnfs41client.bash - simple Cygwin frontent for the msnfsv41 NFSv4.1 filesystem driver by Anonymous
modification of post by Anonymous (view diff)

  1. #!/bin/bash
  2.  
  3. #
  4. # msnfs41client.bash - simple Cygwin frontent for the msnfsv41
  5. # NFSv4.1 filesystem driver
  6. #
  7.  
  8. #
  9. # Written by Roland Mainz <roland.mainz@nrubsig.org>
  10. #
  11.  
  12. function nfsclient_install
  13. {
  14.         set -o nounset
  15.         set -o xtrace
  16.         set -o errexit
  17.        
  18.         #
  19.         # Test whether we have the Windows permissions to install DLLs
  20.         # and the kernel module
  21.         #
  22.         if ! [[ "$(id -G)" =~ (^|[[:space:]]+)544([[:space:]]+|$) ]] ; then
  23.                 printf $"%s: Install requires Windows Adminstator permissions.\n" "$0"
  24.                 return 1
  25.         fi
  26.        
  27.         # make sure all binaries are executable, Windows cmd does
  28.         # not care, but Cygwin&bash do.
  29.         # If *.ddl are not executable nfs*.exe fail with 0xc0000022
  30.         chmod a+x *.exe *.dll
  31.  
  32.         if false ; then
  33.                 # install.bat needs PATH to include $PWD
  34.                 PATH="$PWD:$PATH" cmd /c install.bat
  35.         else
  36.                 nfs_install
  37.                 rundll32 setupapi.dll,InstallHinfSection DefaultInstall 132 ./nfs41rdr.inf
  38.         fi
  39.  
  40.         cp etc_netconfig /cygdrive/c/etc/netconfig
  41.         cp ms-nfs41-idmap.conf /cygdrive/c/etc/.
  42.  
  43.         bcdedit /set testsigning on
  44.         regtool -s set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' 'GLOBAL.LOC'
  45.  
  46.         sc query Dfsc
  47.         sc stop Dfsc || true
  48.         sc config Dfsc start=disabled
  49.  
  50.         sc query nfs41_driver
  51.         domainname
  52.  
  53.         return 0
  54. }
  55.  
  56. function nfsclient_rundeamon
  57. {
  58.         set -o xtrace
  59.         set -o nounset
  60.         set -o errexit
  61.        
  62.         nfsd_debug -d 0 --noldap --gid 1616 --uid 1616
  63.         return $?
  64. }
  65.  
  66. function nfsclient_mount_homedir
  67. {
  68.         set -o xtrace
  69.         set -o nounset
  70.        
  71.         nfs_mount -p -o sec=sys H 'derfwpc5131:/export/home/rmainz'
  72.         mount -o bind,posix=1 /cygdrive/h /home/rmainz
  73.         return $?
  74. }
  75.  
  76. function nfsclient_umount_homedir
  77. {
  78.         set -o xtrace
  79.         set -o nounset
  80.        
  81.         nfs_mount -d H
  82.         return $?
  83. }
  84.  
  85. function main
  86. {
  87.         typeset cmd="$1"
  88.        
  89.         export PATH="$PWD:$PATH"
  90.        
  91.         if ! which 'nfsd.exe' >/dev/null 2>&1 ; then
  92.                 printf $"%s: nfsd not found in %q\n" "$0" "$PWD" 1>&2
  93.                 return 1
  94.         fi
  95.         if ! which 'nfs_mount.exe' >/dev/null 2>&1 ; then
  96.                 printf $"%s: nfs_mount not found in %q\n" "$0" "$PWD" 1>&2
  97.                 return 1
  98.         fi
  99.        
  100.         case "$cmd" in
  101.                 'install')
  102.                         nfsclient_install
  103.                         return $?
  104.                         ;;
  105.                 'run_deamon' | 'run_daemon')
  106.                         nfsclient_rundeamon
  107.                         return $?
  108.                         ;;
  109.                 'mount_homedir')
  110.                         nfsclient_mount_homedir
  111.                         return $?
  112.                         ;;
  113.                 'umount_homedir')
  114.                         nfsclient_umount_homedir
  115.                         return $?
  116.                         ;;
  117.                 *)
  118.                         printf $"%s: Unknown cmd %q\n" "$0" "$cmd" 1>&2
  119.                         return 1
  120.                         ;;
  121.         esac
  122.         return 1
  123. }
  124.  
  125. main "$@"
  126. exit $?
  127.  
  128. # EOF.

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at