summaryrefslogtreecommitdiffstats
path: root/system-boot/components/9990-netboot.sh
blob: 5054fb88fa42ab2c76e795c3680d82604a06e500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

#set -e

do_netmount()
{
	do_netsetup

	if [ "${NFSROOT}" = "auto" ]
	then
		NFSROOT=${ROOTSERVER}:${ROOTPATH}
	fi

	rc=1

	if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] )
	then
		do_httpmount
		return $?
	fi

	if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
	then
		NFSROOT=${ROOTSERVER}:${NFSROOT}
	fi

	log_begin_msg "Trying netboot from ${NFSROOT}"

	if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
	then
		rc=0
	elif do_nfsmount
	then
		NETBOOT="nfs"
		export NETBOOT
		rc=0
	fi

	log_end_msg
	return ${rc}
}