File: bootloader.sh

package info (click to toggle)
kickseed 0.64
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 304 kB
  • sloc: sh: 1,709; makefile: 2
file content (63 lines) | stat: -rw-r--r-- 1,361 bytes parent folder | download | duplicates (7)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/sh

bootloader_handler_common () {
	useLilo="$1"
	shift
	# TODO --linear, --nolinear, --lba32
	eval set -- "$(getopt -o '' -l location:,password:,md5pass:,useLilo,upgrade -- "$@")" || { warn_getopt bootloader; return; }
	while :; do
		case $1 in
			--location)
				case $2 in
					mbr)
						# TODO: not always hd0; lilo
						ks_preseed d-i grub-installer/bootdev string '(hd0)'
						;;
					partition)
						# TODO: lilo
						ks_preseed d-i grub-installer/bootdev string '(hd0,1)'
						;;
					none)
						# TODO: need lilo-installer/skip too
						ks_preseed d-i grub-installer/skip boolean true
						;;
					*)
						warn_bad_arg bootloader location "$2"
						;;
				esac
				shift 2
				;;
			--password)
				# requires grub-installer 1.09
				ks_preseed d-i grub-installer/password password "$2"
				shift 2
				;;
			--md5pass)
				# requires grub-installer 1.31
				ks_preseed d-i grub-installer/password-crypted password "$2"
				shift 2
				;;
			--useLilo)
				useLilo=1
				shift
				;;
			--upgrade)
				warn "upgrades using installer not supported"
				;;
			--)	shift; break ;;
			*)	warn_getopt bootloader; return ;;
		esac
	done

	if [ "$useLilo" = 1 ]; then
		ks_preseed d-i grub-installer/skip boolean true
	fi
}

bootloader_handler () {
	bootloader_handler_common 0 "$@"
}

lilo_handler () {
	bootloader_handler_common 1 "$@"
}