summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/10-install_ipxe.inc
blob: 5e22a24bf4bb49a64ba6bbe42286794df06597f9 (plain) (blame)
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
42
43
44
45

install_ipxe() {
	[ -z "$1" ] && perror "Call install_ipxe with target directory!"
	git clone --branch openslx https://git.openslx.org/openslx-ng/ipxe.git "$1" || perror "Cloning ipxe repo failed"
	cp "$BASEDIR/static_files/pxelinux.0" "$1/" || perror "Could not copy pxelinux.0 to $1"
	# Symlink for USB-Stick HTTP access
	mkdir -p "$WWWDIR"
	ln -s -f "$TFTPDIR" "$WWWDIR/tftp" || perror "Could not create symlink for tftp dir"
	# Patch config
	local PATH_IPXE="$1"
	ipxe_enable CONSOLE_FRAMEBUFFER CONSOLE_CMD MENU_CMD PARAM_CMD DOWNLOAD_PROTO_HTTPS IMAGE_PNG NVO_CMD IFMGMT_CMD LOGIN_CMD SHELL_CMD MENU_CMD REBOOT_CMD POWEROFF_CMD
	ipxe_disable NET_PROTO_STP NET_PROTO_LACP CRYPTO_80211_WEP CRYPTO_80211_WPA CRYPTO_80211_WPA2 IWMGMT_CMD IBMGMT_CMD FCMGMT_CMD CONSOLE_SERIAL
}

compile_ipxe() {
	echo "*** compiling iPXE in the background ..."
	echo
	[ -z "$1" ] && perror "Call compile_ipxe with target directory!"
	cd "$1/src"
	make bin/undionly.kkkpxe
	chown -R taskmanager:www-data "$1"
	if [ "$ERR" -ne 0 ]; then
		pwarning "*** Background compilation of iPXE failed."
	else
		echo "*** Background compilation of iPXE successful."
	fi
	echo
}

ipxe_enable () {
	local var
	while [ $# -gt 0 ]; do
		var="$1"
		sed -i -r "s~^\\s*(//\\s*#define|#undef)\\s+${var}(\\s|$)~#define ${var} /* enabled by bwLehrpool */\\2~" "$PATH_IPXE"/src/config/*.h || pwarning "Could not enable iPXE option $var"
		shift
	done
}
ipxe_disable () {
	local var
	while [ $# -gt 0 ]; do
		var="$1"
		sed -i -r "s~^\\s*(//\\s*#undef|#define)\\s+${var}(\\s|\$)~#undef ${var} /* disabled by bwLehrpool */\\2~" "$PATH_IPXE"/src/config/*.h || pwarning "Could not disable iPXE option $var"
		shift
	done
}