File: extlinux

package info (click to toggle)
ganeti-instance-debootstrap 0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: sh: 488; makefile: 54
file content (56 lines) | stat: -rwxr-xr-x 1,103 bytes parent folder | download
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
#!/bin/bash 
#
# This is an example script that install and configure EXTLINUX boot loader
# after installation.  Requires extlinux (package) to be available on nodes.
# Tested on Debian 10.
#
# To use it put it in your CUSTOMIZE_DIR and make it executable.
#

set -e

. common.sh

CLEANUP=( )

trap cleanup EXIT

ELINSTALLER="/usr/bin/extlinux"
MBRFILE="/usr/lib/EXTLINUX/mbr.bin"

if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
  echo "Missing target directory"
  exit 1
fi

if [ "$PARTITION_STYLE" = 'msdos' ]; then
	if [ ! -e "$ELINSTALLER" ]; then
	  echo "Missing extlinux installer on $(/usr/bin/hostname)"
	  exit 1
	fi

	if [ ! -e "$MBRFILE" ]; then
	  echo "Missing extlinux MBR file on $(/usr/bin/hostname)"
	  exit 1
	fi

	# extlinux install
	cat << EOF > "$TARGET/boot/extlinux.conf"
PROMPT 1
TIMEOUT 10
DEFAULT Linux

LABEL Linux
	LINUX /vmlinuz
	APPEND root=/dev/vda1 ro
	INITRD /initrd.img

LABEL Linux_old
	LINUX /vmlinuz.old
	APPEND root=/dev/vda1 ro
	INITRD /initrd.img.old
EOF
	"$ELINSTALLER" -i "$TARGET/boot/"
# install extlinux MBR on boot device
	cat "$MBRFILE" > "$DISK_0_PATH"
fi