pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 0d2 by Anonymous on Tue 5th Sep 2023 11:49
original post b55158 by Anonymous on Mon 4th Sep 2023 13:34
Download diff
Show old version | new version | both versions

    
11
#!/bin/bash
22
33
#
44
# msnfs41client.bash - simple Cygwin frontent for the msnfsv41
55
# NFSv4.1 filesystem driver
66
#
77
88
#
99
# Written by Roland Mainz <roland.mainz@nrubsig.org>
1010
#
1111
1212
function nfsclient_install
1313
{
1414
	set -o nounset
1515
	set -o xtrace
1616
	set -o errexit
1717
1818
	#
1919
	# Test whether we have the Windows permissions to install DLLs
2020
	# and the kernel module
2121
	#
2222
	if ! [[ "$(id -G)" =~ (^|[[:space:]]+)544([[:space:]]+|$) ]] ; then
2323
		printf $"%s: Install requires Windows Adminstator permissions.\n" "$0"
2424
		return 1
2525
	fi
2626
2727
	# make sure all binaries are executable, Windows cmd does
2828
	# not care, but Cygwin&bash do.
2929
	# If *.ddl are not executable nfs*.exe fail with 0xc0000022
3030
	chmod a+x *.exe *.dll
3131
3232
	if false ; then
3333
		# install.bat needs PATH to include $PWD
3434
		PATH="$PWD:$PATH" cmd /c install.bat
3535
	else
3636
		nfs_install
3737
		rundll32 setupapi.dll,InstallHinfSection DefaultInstall 132 ./nfs41rdr.inf
3838
	fi
3939
4040
	cp etc_netconfig /cygdrive/c/etc/netconfig
4141
	cp ms-nfs41-idmap.conf /cygdrive/c/etc/.
4242
4343
	bcdedit /set testsigning on
4444
	regtool -s set '/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/Domain' 'GLOBAL.LOC'
4545
4646
	sc query Dfsc
4747
	sc stop Dfsc || true
4848
	sc config Dfsc start=disabled
4949
5050
	sc query nfs41_driver
5151
	domainname
5252
5353
	return 0
5454
}
5555
5656
function nfsclient_rundeamon
5757
{
5858
	set -o xtrace
5959
	set -o nounset
6060
	set -o errexit
6161
6262
	nfsd_debug -d 0 --noldap --gid 1616 --uid 1616
6363
	return $?
6464
}
6565
6666
function nfsclient_mount_homedir
6767
{
6868
	set -o xtrace
6969
	set -o nounset
7070
7171
	nfs_mount -p -o sec=sys H 'derfwpc5131:/export/home/rmainz'
7272
	mount -o bind,posix=1 /cygdrive/h /home/rmainz
7373
	return $?
7474
}
7575
7676
function nfsclient_umount_homedir
7777
{
7878
	set -o xtrace
7979
	set -o nounset
8080
8181
	nfs_mount -d H
8282
	return $?
8383
}
8484
8585
function main
8686
{
8787
	typeset cmd="$1"
8888
8989
	export PATH="$PWD:$PATH"
9090
9191
	if ! which 'nfsd.exe' >/dev/null 2>&1 ; then
9292
		printf $"%s: nfsd not found in %q\n" "$0" "$PWD" 1>&2
9393
		return 1
9494
	fi
9595
	if ! which 'nfs_mount.exe' >/dev/null 2>&1 ; then
9696
		printf $"%s: nfs_mount not found in %q\n" "$0" "$PWD" 1>&2
9797
		return 1
9898
	fi
9999
100100
	case "$cmd" in
101101
		'install')
102102
			nfsclient_install
103103
			return $?
104104
			;;
105105
		'run_deamon' | 'run_daemon')
106106
			nfsclient_rundeamon
107107
			return $?
108108
			;;
109109
		'mount_homedir')
110110
			nfsclient_mount_homedir
111111
			return $?
112112
			;;
113113
		'umount_homedir')
114114
			nfsclient_umount_homedir
115115
			return $?
116116
			;;
117117
		*)
118118
			printf $"%s: Unknown cmd %q\n" "$0" "$cmd" 1>&2
119119
			return 1
120120
			;;
121121
	esac
122122
	return 1
123123
}
124124
125125
main "$@"
126126
exit $?
127127
128128
# EOF.
129129

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