blob: 78211f43db6d501e1aa5f0971b15916d56524af9 (
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
|
#!/bin/bash
# Copyright (C) 2018 Iru Cai <mytbk920423@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
# Example: ./install_syslinux /dev/sdb /dev/sdb1 /media/boot
set -e
mbr_bin_path=(/usr/lib/syslinux/bios /usr/share/syslinux /usr/lib/syslinux/mbr)
c32_path=(/usr/lib/syslinux/bios /usr/share/syslinux /usr/lib/syslinux/modules/bios)
MBR_PATH=""
C32_PATH=""
for path in "${mbr_bin_path[@]}"
do
if test -f "$path/mbr.bin"
then
MBR_PATH="$path"
break
fi
done
if test -z "$MBR_PATH"
then
exit 1
fi
for path in "${c32_path[@]}"
do
if test -f "$path/linux.c32"
then
C32_PATH="$path"
break
fi
done
if test -z "$C32_PATH"
then
exit 1
fi
DEVNAME="$1"
BOOTPART="$2"
BOOTPATH="$3"
syslinux -i "$BOOTPART"
dd bs=440 count=1 conv=notrunc if="$MBR_PATH/mbr.bin" of="$DEVNAME"
install -d "$BOOTPATH/syslinux"
cp "$C32_PATH"/*.c32 "$BOOTPATH/syslinux"
|