summaryrefslogtreecommitdiffstats
path: root/config/binary_local-hooks/40-include_syslinux_in_ISO_filesystem
blob: 27a1cdd72526645bdf427da380b74ddcc09f7585 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

set -e

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

# Setting static variables
DESCRIPTION="$(Echo 'including syslinux in the ISO filesystem')"
HELP=""
USAGE="${PROGRAM}"

# Reading configuration files
Read_conffiles config/all config/bootstrap config/common config/binary
Set_defaults

# Safeguards
[ "${LB_BOOTLOADER}"   = "syslinux" ] || exit 0
[ "${LB_ARCHITECTURE}" = "i386"     ] || exit 0

# Seems like we'll have work to do
Echo_message 'including syslinux in the ISO filesystem'

# Variables
LINUX_BINARY_UTILS_DIR='binary/utils/linux'
WIN32_BINARY_UTILS_DIR='binary/utils/win32'
BINARY_MBR_DIR='binary/utils/mbr'
CHROOT_SYSLINUX_BIN='chroot/usr/bin/syslinux'
CHROOT_SYSLINUX_MBR='chroot/usr/lib/SYSLINUX/gptmbr.bin'
CHROOT_TEMP_APT_SOURCES='chroot/etc/apt/sources.list.d/tmp-deb-src.list'

# Functions

syslinux_deb_version_in_chroot () {
   chroot chroot dpkg-query -W -f='${Version}\n' syslinux
}

# Main
mkdir -p "$LINUX_BINARY_UTILS_DIR" "$WIN32_BINARY_UTILS_DIR" "$BINARY_MBR_DIR"
cp "$CHROOT_SYSLINUX_BIN" "$LINUX_BINARY_UTILS_DIR/"
cp "$CHROOT_SYSLINUX_MBR" "$BINARY_MBR_DIR/mbr.bin"

cat chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/*.list \
   | sed --regexp-extended -e 's,^deb(\s+),deb-src\1,' \
   > "$CHROOT_TEMP_APT_SOURCES"
mv chroot/etc/apt/apt.conf.d/{,.}0000runtime-proxy
Chroot chroot apt-get --yes update
Chroot chroot apt-get --yes install dpkg-dev
Chroot chroot apt-get source syslinux="$(syslinux_deb_version_in_chroot)"
cp chroot/syslinux-*/bios/win32/syslinux.exe "$WIN32_BINARY_UTILS_DIR/"
rm -r chroot/syslinux*
rm "$CHROOT_TEMP_APT_SOURCES"
mv chroot/etc/apt/apt.conf.d/{.,}0000runtime-proxy
Chroot chroot apt-get --yes update
Chroot chroot apt-get --yes purge dpkg-dev make # dpkg-dev depends on make