pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 08b12c by Anonymous on Mon 11th Sep 2023 12:22
original post 0d2 by Anonymous on Tue 5th Sep 2023 11:49
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'
72+
	mkdir -p /home/rmainz
7273
	mount -o bind,posix=1 /cygdrive/h /home/rmainz
7374
	return $?
7475
}
7576
7677
function nfsclient_umount_homedir
7778
{
7879
	set -o xtrace
7980
	set -o nounset
8081
8182
	nfs_mount -d H
83+
	# remove bind mount
8286
	return $?
8387
}
8488
8589
function main
8690
{
8791
	typeset cmd="$1"
8892
8993
	export PATH="$PWD:$PATH"
9094
9195
	if ! which 'nfsd.exe' >/dev/null 2>&1 ; then
9296
		printf $"%s: nfsd not found in %q\n" "$0" "$PWD" 1>&2
9397
		return 1
9498
	fi
9599
	if ! which 'nfs_mount.exe' >/dev/null 2>&1 ; then
96100
		printf $"%s: nfs_mount not found in %q\n" "$0" "$PWD" 1>&2
97101
		return 1
98102
	fi
99103
100104
	case "$cmd" in
101105
		'install')
102106
			nfsclient_install
103107
			return $?
104108
			;;
105109
		'run_deamon' | 'run_daemon')
106110
			nfsclient_rundeamon
107111
			return $?
108112
			;;
109113
		'mount_homedir')
110114
			nfsclient_mount_homedir
111115
			return $?
112116
			;;
113117
		'umount_homedir')
114118
			nfsclient_umount_homedir
115119
			return $?
116120
			;;
117121
		*)
118122
			printf $"%s: Unknown cmd %q\n" "$0" "$cmd" 1>&2
119123
			return 1
120124
			;;
121125
	esac
122126
	return 1
123127
}
124128
125129
main "$@"
126130
exit $?
127131
128132
# EOF.
129133

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