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 28th Aug 2023 00:35
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 1000 --uid 1000
  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 '192.168.2.150:/home/test001'
  72.         return $?
  73. }
  74.  
  75. function nfsclient_umount_homedir
  76. {
  77.         set -o xtrace
  78.         set -o nounset
  79.        
  80.         nfs_mount -d H
  81.         return $?
  82. }
  83.  
  84. function main
  85. {
  86.         typeset cmd="$1"
  87.        
  88.         export PATH="$PWD:$PATH"
  89.        
  90.         if ! which 'nfsd.exe' >/dev/null 2>&1 ; then
  91.                 printf $"%s: nfsd not found in %q\n" "$0" "$PWD" 1>&2
  92.                 return 1
  93.         fi
  94.         if ! which 'nfs_mount.exe' >/dev/null 2>&1 ; then
  95.                 printf $"%s: nfs_mount not found in %q\n" "$0" "$PWD" 1>&2
  96.                 return 1
  97.         fi
  98.        
  99.         case "$cmd" in
  100.                 'install')
  101.                         nfsclient_install
  102.                         return $?
  103.                         ;;
  104.                 'run_deamon')
  105.                         nfsclient_rundeamon
  106.                         return $?
  107.                         ;;
  108.                 'mount_homedir')
  109.                         nfsclient_mount_homedir
  110.                         return $?
  111.                         ;;
  112.                 'umount_homedir')
  113.                         nfsclient_umount_homedir
  114.                         return $?
  115.                         ;;
  116.                 *)
  117.                         printf $"%s: Unknown cmd %q\n" "$0" "$cmd" 1>&2
  118.                         return 1
  119.                         ;;
  120.         esac
  121.         return 1
  122. }
  123.  
  124. main "$@"
  125. exit $?
  126.  
  127. # 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