binary_syslinux 15.4 KB
Newer Older
1
2
#!/bin/sh

3
4
5
6
7
8
9
## live-build(7) - System Build Scripts
## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
##
## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.

10
11
12

set -e

13
# Including common functions
14
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
15

16
# Setting static variables
17
DESCRIPTION="$(Echo 'installs syslinux into binary')"
18
19
20
21
22
HELP=""
USAGE="${PROGRAM} [--force]"

Arguments "${@}"

23
# Reading configuration files
24
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25
26
Set_defaults

27
if [ "${LB_BOOTLOADER}" != "syslinux" ]
28
29
30
31
then
	exit 0
fi

32
Echo_message "Begin installing syslinux..."
33

34
# Requiring stage file
35
Require_stagefile .stage/config .stage/bootstrap
36

37
38
39
# Checking stage file
Check_stagefile .stage/binary_syslinux

40
41
42
# Checking syslinux templates
Check_templates syslinux

43
# Checking lock file
44
Check_lockfile .lock
45
46

# Creating lock file
47
Create_lockfile .lock
48

49
# Check architecture
50
Check_architecture amd64 i386
51
Check_crossarchitecture
52

53
54
# Checking depends
Check_package chroot/usr/bin/syslinux syslinux
55

56
57
58
# Restoring cache
Restore_cache cache/packages_binary

59
60
# Installing depends
Install_package
61

62
# Local functions
63
64
65
66
67
68
69
Utf8_to_latin1 ()
{
	VALUE="${1}"

	echo "${VALUE}" | iconv -f utf-8 -t latin1
}

70
71
72
Syslinux_memtest_entry ()
{
	LABEL="${1}"
73
	MENULABEL="$(Utf8_to_latin1 "${2}")"
74
75
	KERNEL="${3}"

76
	MEMTEST="${MEMTEST}\nlabel ${LABEL}\n"
77

78
	# Write the menu label if the syslinux menu is being use
79
	MEMTEST="${MEMTEST}\tmenu label ${MENULABEL}\n"
80
	MEMTEST="${MEMTEST}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
81
	MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')"
82
83
}

84
85
86
Syslinux_live_entry ()
{
	LABEL="${1}"
87
	MENULABEL="$(Utf8_to_latin1 "${2}")"
88
89
90
91
	MENULABEL="${2}"
	KERNEL="${3}"
	INITRD="${4}"
	APPEND="${5}"
92

93
	case "${LB_BINARY_IMAGES}" in
94
		iso*|usb*)
95
96
			NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)"
			NUMBER="$((${NUMBER} +1))"
97

98
99
100
101
102
103
			# Do not add numbering to filenames if first kernel/initrd
			if [ "${NUMBER}" = "1" ]
			then
				NUMBER=""
			fi

104
			# Note: ISOLINUX will not find the kernel if the name ends in ".img".
105
106
107
108
109
110
111
112
113
			if [ -e ${KERNEL_PATH}/${KERNEL} ]
			then
				mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${NUMBER}
			fi

			if [ -e ${KERNEL_PATH}/${INITRD} ]
			then
				mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${NUMBER}.img
			fi
114

115
116
117
118
			KERNEL=vmlinuz${NUMBER}
			INITRD=initrd${NUMBER}.img
		;;
	esac
119
120

	# Regular kernel
121
	LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}\n"
122

123
	# Write the menu label if the syslinux menu is being use
124
125
126
127
128
	if [ -n "${MENULABEL}" ]
	then
		LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL}\n"
	fi

129
	LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
130
	LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} live-config ${LB_BOOTAPPEND_LIVE} ${APPEND}\n"
131

132
	# Failsafe kernel
133
	LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}failsafe\n"
134

135
	# Write the menu label if the syslinux menu is being use
136
137
138
139
140
	if [ -n "${MENULABEL}" ]
	then
		LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL} (failsafe)\n"
	fi

141
	LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n"
142
	LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} live-config ${LB_BOOTAPPEND_LIVE} ${APPEND} ${FAILSAFE}\n"
143
144
145
146
147
148
149
150
151
}

Syslinux_install_entry ()
{
	LABEL="${1}"
	KERNEL="${2}"
	INITRD="${3}"
	APPEND="${4}"

152
	# Boot in quiet mode where appropriate
153
	QAPPEND="quiet"
154

155
156
	for TYPE in Install Expert Rescue Auto
	do
157
158
		case "${TYPE}" in
			Install)
159
				TAPPEND="${APPEND} ${QAPPEND}"
160
				;;
161

162
			Expert)
163
				TAPPEND="priority=low ${APPEND}"
164
				;;
165

166
			Rescue)
167
				TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}"
168
				;;
169

170
			Auto)
171
				TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}"
172
173
174
				;;
		esac

175
176
177
178
179
180
181
182
183
		case "${LABEL}" in
			Text)
				TYPE_SUFFIX=""
				;;
			GUI)
				TYPE_SUFFIX="gui"
				;;
		esac

184
185
		LINUX_INSTALL="${LINUX_INSTALL}\nlabel $(echo "${TYPE}" | tr A-Z a-z)${TYPE_SUFFIX}\n"
		LINUX_INSTALL="${LINUX_INSTALL}\tmenu label ${LABEL} ${TYPE}\n"
186
		LINUX_INSTALL="${LINUX_INSTALL}\tkernel ${LIVE_INSTALL_KERNEL_PATH}/${KERNEL}\n"
187
		LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=${LIVE_INSTALL_KERNEL_PATH}/${INITRD} ${TAPPEND} ${LB_BOOTAPPEND_INSTALL}\n"
188
	done
189
190
}

191
192
Copy_syslinux_templates ()
{
193
194
	cp -r "${TEMPLATES}"/common/* ${SCREEN_PATH}

195
	if [ "${LB_SYSLINUX_MENU}" = "false" ]
196
	then
197
		cp -r "${TEMPLATES}"/normal/* ${SCREEN_PATH}
198
	else
199
		cp -r "${TEMPLATES}"/menu/* ${SCREEN_PATH}
200

201
		case "${LB_SYSLINUX_MENU}" in
202
			gfxboot)
203
				MENUMODULE="gfxboot.c32"
204
205
206
207
208
209
210
211
212
213
214
				;;

			menu)
				MENUMODULE="menu.c32"
				;;

			vesamenu)
				MENUMODULE="vesamenu.c32"
				;;

			*)
215
				if [ -z "${LB_SYSLINUX_CFG}" ]
216
217
218
				then
					MENUMODULE=$(grep 'menu.c32' ${TEMPLATES}/menu/syslinux.cfg | sed 's|default\s*.*/\(.*menu.c32\)$|\1|g')
				else
219
					LB_SYSLINUX_CFG="${LB_SYSLINUX_CFG:-${TEMPLATES}/menu/syslinux.cfg}"
220
221
222
223
				fi
				;;
		esac

224
		case "${LB_BUILD_WITH_CHROOT}" in
225
			true)
226
227
				cp chroot/usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH}
				;;
228
			false)
229
230
231
				cp /usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH}
				;;
		esac
232
	fi
233

234
	if ls "${TEMPLATES}/${LB_LANGUAGE}"/* > /dev/null 2>&1
235
	then
236
		cp -r "${TEMPLATES}"/"${LB_LANGUAGE}"/* ${SCREEN_PATH}
237
	else
238
239
240
241
		if ls "${TEMPLATES}"/en/* > /dev/null 2>&1
		then
			cp -r "${TEMPLATES}"/en/* ${SCREEN_PATH}
		fi
242
	fi
243

244
	if ls ${SCREEN_PATH}/*.live > /dev/null 2>&1
245
	then
246
		for FILE in ${SCREEN_PATH}/*.live
247
		do
248
			mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live)
249
		done
250
251
	fi

252
	if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
253
254
255
256
257
258
259
260
	then
		if ls ${SCREEN_PATH}/*.install > /dev/null 2>&1
		then
			for FILE in ${SCREEN_PATH}/*.install
			do
				mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install)
			done
		fi
261

262
		case "${LB_ARCHITECTURE}" in
263
			amd64|i386|powerpc)
264
265
266
267
268
269
270
				if ls ${SCREEN_PATH}/*.install.g-i > /dev/null 2>&1
				then
					for FILE in ${SCREEN_PATH}/*.install.g-i
					do
						mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i)
					done
				fi
271
272
273
274
275
276
				;;

			*)
				rm -f ${SCREEN_PATH}/*.install.g-i
				;;
		esac
277
278
279
	else
		rm -f ${SCREEN_PATH}/*.install*
	fi
280

281
	if [ "${LB_SYSLINUX_MENU}" != "false" ]
282
283
284
285
	then
		rm -f ${DATA_PATH}/boot.txt
	fi

286
	# Copying custom splash screen
287
	if [ "${LB_SYSLINUX_SPLASH}" = "none" ]
288
289
290
291
292
293
	then
		# no splash screen
		SPLASH=""
		rm -f ${SCREEN_PATH}/splash.rle
		rm -f ${DATA_PATH}/splash.png
	else
294
		if [ "${LB_SYSLINUX_MENU}" = "false" ]
295
		then
296
			SPLASH="${LIVE_DATA_PATH}/splash.rle"
297
		else
298
			SPLASH="${LIVE_DATA_PATH}/splash.png"
299
		fi
300

301
		if [ -n "${LB_SYSLINUX_SPLASH}" ]
302
		then
303
			if [ ! -e "${LB_SYSLINUX_SPLASH}" ]
304
			then
305
				Echo_error "%s doen't exist" "${LB_SYSLINUX_SPLASH}"
306
307
308
309
				exit 1
			else
				rm -f ${SCREEN_PATH}/splash.rle
				rm -f ${DATA_PATH}/splash.png
310
				cp -f "${LB_SYSLINUX_SPLASH}" ${DATA_PATH}/$(basename ${SPLASH})
311
312
			fi
		fi
313
	fi
314
315
316
317
}

Configure_syslinux_templates ()
{
318
319
320
321
	templates="$(find ${SYSLINUX_PATH} -type f -name '*.cfg' -o -name '*.txt')"

	for template_file in ${templates}
	do
322
323
324
325
326
327
		sed -i -e "s|{\$LINUX_LIVE}|${LINUX_LIVE}|" \
		       -e "s|{\$LINUX_INSTALL}|${LINUX_INSTALL}|" \
		       -e "s|{\$MEMTEST}|${MEMTEST}|" \
		       -e "s|{\$LIVE_SCREEN_PATH}|${LIVE_SCREEN_PATH}|" \
		       -e "s|{\$LIVE_DATA_PATH}|${LIVE_DATA_PATH}|" \
		       -e "s|{\$LIVE_KERNEL_PATH}|${LIVE_KERNEL_PATH}|" \
328
		       -e "s|{\$SPLASH}|${SPLASH}|" \
329
330
331
332
333
		       -e "s|{\$LB_DISTRIBUTION}|${LB_DISTRIBUTION}|" \
		       -e "s|{\$LB_DATE}|$(date +%Y%m%d)|" \
		       -e "s|{\$LB_MEDIA}|${MEDIA}|" \
		       -e "s|{\$LB_VERSION}|${VERSION}|" \
		       -e "s|{\$LB_SYSLINUX_TIMEOUT}|${LB_SYSLINUX_TIMEOUT}0|" \
334
335
		$template_file
	done
336

337
	case "${LB_BINARY_IMAGES}" in
338
		usb*)
339
340
341
342
343
344
345
346
347
348
349
350
351
			if [ -f "${SYSLINUX_PATH}/exithelp.cfg" ]
			then
				sed -i -e "s|config isolinux.cfg|config syslinux.cfg|" "${SYSLINUX_PATH}"/exithelp.cfg
			fi
			;;

		net)
			if [ -f "${SCREEN_PATH}/exithelp.cfg" ]
			then
				sed -i -e "s|config isolinux.cfg|config ${LIVE_KERNEL_PATH}/pxelinux.cfg/default|" "${SCREEN_PATH}"/exithelp.cfg
			fi
			;;
	esac
352
353
354
}

# Setting up common variables
355
case "${LB_INITRAMFS}" in
356
357
358
359
	casper)
		INITFS="casper"
		;;

360
	live-initramfs|live-boot)
361
362
363
364
		INITFS="live"
		;;
esac

365
# Setting boot method specific variables
366
case "${LB_BINARY_IMAGES}" in
367
	iso*)
368
		SYSLINUX_PATH="binary/isolinux"
369
370
		KERNEL_PATH="binary/${INITFS}"
		SCREEN_PATH="${SYSLINUX_PATH}"
371
		DATA_PATH="${SCREEN_PATH}"
372
373
374
		LIVE_KERNEL_PATH="/${INITFS}"
		LIVE_INSTALL_KERNEL_PATH="/install"
		LIVE_SCREEN_PATH="/isolinux"
375
		LIVE_DATA_PATH="${LIVE_SCREEN_PATH}"
376
		MEDIA="CD-ROM"
377
378
379
		;;

	net)
380
		SYSLINUX_PATH="tftpboot"
381
382
		KERNEL_PATH="${SYSLINUX_PATH}/debian-live/${LB_ARCHITECTURE}"
		SCREEN_PATH="${SYSLINUX_PATH}/debian-live/${LB_ARCHITECTURE}/boot-screens"
383
		DATA_PATH="${SCREEN_PATH}"
384
385
386
		LIVE_KERNEL_PATH="debian-live/${LB_ARCHITECTURE}"
		LIVE_INSTALL_KERNEL_PATH="debian-install/${LB_ARCHITECTURE}"
		LIVE_SCREEN_PATH="debian-live/${LB_ARCHITECTURE}/boot-screens"
387
		LIVE_DATA_PATH="${LIVE_SCREEN_PATH}"
388
		MEDIA="netboot"
389
		;;
390

391
	usb*|tar)
392
		SYSLINUX_PATH="binary/syslinux"
393
394
		KERNEL_PATH="binary/${INITFS}"
		SCREEN_PATH="${SYSLINUX_PATH}"
395
		DATA_PATH="${SCREEN_PATH}"
396
397
398
		LIVE_KERNEL_PATH="/${INITFS}"
		LIVE_INSTALL_KERNEL_PATH="/install"
		LIVE_SCREEN_PATH="/syslinux"
399
		LIVE_DATA_PATH="${LIVE_SCREEN_PATH}"
400
		MEDIA="hd-media"
401
402
403
		;;
esac

404
Check_multiarchitecture
405

406
407
408
409
# Creating directories
mkdir -p "${KERNEL_PATH}"
mkdir -p "${SCREEN_PATH}"
mkdir -p "${DATA_PATH}"
410

411
# Setting boot parameters
412
case "${LB_ENCRYPTION}" in
413
	""|false)
414
415
		;;
	*)
416
		LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} encryption=${LB_ENCRYPTION}"
417
418
		;;
esac
419

420
if [ -n "${LB_USERNAME}" ]
421
then
422
	case "${LB_INITRAMFS}" in
423
		casper)
424
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} username=${LB_USERNAME}"
425
426
			;;

427
		live-initramfs|live-boot)
428
			if [ "${LB_USERNAME}" != "user" ]
429
			then
430
				LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} username=${LB_USERNAME}"
431
432
433
			fi
			;;
	esac
434
fi
435

436
if [ -n "${LB_HOSTNAME}" ]
437
then
438
	case "${LB_INITRAMFS}" in
439
		casper)
440
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} hostname=${LB_HOSTNAME}"
441
442
			;;

443
		live-initramfs|live-boot)
444
			if [ "${LB_HOSTNAME}" != "debian" ]
445
			then
446
				LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} hostname=${LB_HOSTNAME}"
447
448
449
			fi
			;;
	esac
450
fi
451

452
if [ "${LB_UNION_FILESYSTEM}" != "aufs" ]
453
then
454
	LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}"
455
456
fi

457
if [ "${LB_EXPOSED_ROOT}" != "false" ]
458
then
459
	LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot"
460
461
fi

462
if [ "${LB_BINARY_IMAGES}" = "net" ]
463
then
464
	case "${LB_NET_ROOT_FILESYSTEM}" in
465
		nfs)
466
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} netboot=nfs nfsroot=${LB_NET_ROOT_SERVER}:${LB_NET_ROOT_PATH}"
467
468
469
			;;

		cifs)
470
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//${LB_NET_ROOT_SERVER}${LB_NET_ROOT_PATH}"
471
472
473
474
475
476
477
478
			;;

		*)
			Echo_error "Unsupported net filesystem"
			exit 1
			;;
	esac

479
	if [ -n "${LB_NET_ROOT_MOUNTOPTIONS}" ]
480
	then
481
		LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} nfsopts=${LB_NET_ROOT_MOUNTOPTIONS}"
482
483
484
	fi
fi

485
if [ -n "${LB_NET_COW_PATH}" ]
486
then
487
	case "${LB_NET_COW_FILESYSTEM}" in
488
		nfs)
489
			if [ -n "${LB_NET_COW_MOUNTOPTIONS}" ]
490
			then
491
				LB_NET_COW_MOUNTOPTIONS=",${LB_NET_COW_MOUNTOPTIONS}"
492
493
			fi

494
			LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} nfscow=${LB_NET_COW_SERVER}:${LB_NET_COW_PATH}${LB_NET_COW_MOUNTOPTIONS}"
495
496
497
498
499
500
501
502
503
			;;

		*)
			Echo_error "Unsupported net filesystem"
			exit 1
			;;
	esac
fi

504
LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's|  ||')"
505

506
# Parameters are listed at: linux/Documentation/kernel-parameters.txt
507
FAILSAFE="noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal"
508

509
510
511
512
513
# Moving kernels into place
if [ "binary/${INITFS}" != "${KERNEL_PATH}" ]
then
	mv binary/${INITFS}/vmlinuz* ${KERNEL_PATH}
	mv binary/${INITFS}/initrd* ${KERNEL_PATH}
514

515
	if [ "${LB_MEMTEST}" != "false" ] && [ "${LB_MEMTEST}" != "none" ]
516
517
518
	then
		mv binary/${INITFS}/memtest ${KERNEL_PATH}
	fi
519
fi
520

521
# Default entries
522
DEFAULT_FLAVOUR="$(echo ${LB_LINUX_FLAVOURS} | awk '{ print $1 }')"
523
DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})"
524
DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')"
525

526
Syslinux_live_entry "live" "${LB_SYSLINUX_MENU_LIVE_ENTRY}" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}"
527

528
if [ "$(echo ${LB_LINUX_FLAVOURS} | wc -w)" -gt "1" ]
529
then
530
	for FLAVOUR in ${LB_LINUX_FLAVOURS}
531
	do
532
533
534
		if [ "${FLAVOUR}" != "${DEFAULT_FLAVOUR}" ]
		then
			FLAVOUR_KERNEL="$(basename chroot/boot/vmlinuz-*${FLAVOUR})"
535
			FLAVOUR_INITRD="initrd.img-$(echo ${FLAVOUR_KERNEL} | sed -e 's|vmlinuz-||')"
536
			Syslinux_live_entry "live-${FLAVOUR}" "${LB_SYSLINUX_MENU_LIVE_ENTRY} ${FLAVOUR}" "${FLAVOUR_KERNEL}" "${FLAVOUR_INITRD}"
537
		fi
538
539
	done
fi
540

541
# Only needed for non-vesamenu, non-gfxboot syslinux
542
case "${LB_SYSLINUX_MENU}" in
543
	false|menu)
544
545
546
547
548
		# Adding syslinux hardcoded default label entry
		Syslinux_live_entry "linux" "" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}"
		;;
esac

549
# Assembling debian-installer configuration
550
if [ "${LB_DEBIAN_INSTALLER}" != "false" ]
551
then
552
553
	VMLINUZ_DI="vmlinuz"
	INITRD_DI="initrd.gz"
554
	APPEND_DI="vga=normal"
555
556
557

	VMLINUZ_GI="gtk/vmlinuz"
	INITRD_GI="gtk/initrd.gz"
558
	APPEND_GI="video=vesa:ywrap,mtrr vga=788"
559

560
561
562
563
564
565
566
567
568
	if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_DI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_DI}" ]
	then
		Syslinux_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}"
	fi

	if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_GI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_GI}" ]
	then
		Syslinux_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}"
	fi
569
570
fi

571
# Assembling memtest configuration
572
if [ -f "${KERNEL_PATH}"/memtest ]
573
then
574
	Syslinux_memtest_entry "memtest" "${LB_SYSLINUX_MENU_MEMTEST_ENTRY}" "memtest"
575
fi
576

577
578
579
580
581
582
583
# Copy templates to base syslinux directory
Copy_syslinux_templates

# Fill in templates with created values
Configure_syslinux_templates

# Configure syslinux setup per boot method
584
case "${LB_BINARY_IMAGES}" in
585
	iso*)
586
		case "${LB_BUILD_WITH_CHROOT}" in
587
			true)
588
				cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}
589
				;;
590
			false)
591
				cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}
592
593
594
				;;
		esac

595
		mv ${SCREEN_PATH}/syslinux.cfg ${SCREEN_PATH}/isolinux.cfg
596

597
		# Copying configuration file
598
		if [ -n "${LB_SYSLINUX_CFG}" ]
599
		then
600
			cp "${LB_SYSLINUX_CFG}" ${SCREEN_PATH}/isolinux.cfg
601
602
		fi
		;;
603

604
	net)
605
		case "${LB_BUILD_WITH_CHROOT}" in
606
			true)
607
				cp chroot/usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH}
608
				;;
609
			false)
610
				cp /usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH}
611
612
613
				;;
		esac

614
		mkdir -p ${KERNEL_PATH}/pxelinux.cfg
615
616
		ln -s ${LIVE_KERNEL_PATH}/pxelinux.cfg ${SYSLINUX_PATH}/pxelinux.cfg
		ln -s ${LIVE_KERNEL_PATH}/pxelinux.0 ${SYSLINUX_PATH}/pxelinux.0
617

618
619
620
621
622
623
		# Adjusting include pathes
		for FILE in ${SCREEN_PATH}/*.cfg
		do
			sed -i -e "s|^include |include ${LIVE_SCREEN_PATH}/|g" "${FILE}"
		done

624
		sed -i -e "s| f| ${LIVE_SCREEN_PATH}/f|g" ${SCREEN_PATH}/prompt.cfg
625

626
		mv ${SCREEN_PATH}/syslinux.cfg ${KERNEL_PATH}/pxelinux.cfg/default
627

628
		# Copying configuration file
629
		if [ -n "${LB_SYSLINUX_CFG}" ]
630
		then
631
			cp "${LB_SYSLINUX_CFG}" ${KERNEL_PATH}/pxelinux.cfg/default
632
633
		fi
		;;
634

635
	usb*|tar)
636
		case "${LB_BUILD_WITH_CHROOT}" in
637
			true)
638
				cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin
639
				;;
640
			false)
641
				cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin
642
643
644
				;;
		esac

645
		# Copying configuration file
646
		if [ -n "${LB_SYSLINUX_CFG}" ]
647
		then
648
			cp "${LB_SYSLINUX_CFG}" ${SCREEN_PATH}/syslinux.cfg
649
650
651
		fi
		;;
esac
652

653
654
655
# Saving cache
Save_cache cache/packages_binary

656
657
# Removing depends
Remove_package
658
659
660

# Creating stage file
Create_stagefile .stage/binary_syslinux