parent
ded9b60bf7
commit
ef7291d9b8
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
function mount_efi()
|
||||
{
|
||||
local drive="$1"
|
||||
local partition="$drive"1
|
||||
if [ ! -b "$partition" ]; then
|
||||
partition="$drive"p1
|
||||
if [ ! -b "$partition" ]; then
|
||||
echo "Can't find first partition for \"$drive\""
|
||||
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
unset mnt
|
||||
mnt="$(mktemp -d)"
|
||||
if ! mount "$partition" "$mnt"; then
|
||||
mkfs.vfat "$partition"
|
||||
if ! mount "$partition" "$mnt"; then
|
||||
echo "Can't mount \"$partition\""
|
||||
cleanup_mnt
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_mnt()
|
||||
{
|
||||
umount "$mnt"
|
||||
flush
|
||||
rmdir "$mnt"
|
||||
}
|
||||
|
||||
function install_syslinux()
|
||||
{
|
||||
local drive="$1"
|
||||
|
||||
mount_efi "$drive"
|
||||
|
||||
# legacy
|
||||
cp /usr/lib/syslinux/modules/bios/*.c32 "$mnt"/syslinux/
|
||||
|
||||
# UEFI
|
||||
cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi "$mnt"/EFI/BOOT/BOOTX64.EFI
|
||||
cp /usr/lib/syslinux/modules/efi64/ldlinux.e64 "$mnt"/EFI/BOOT/ldlinux.e64
|
||||
cp /usr/lib/syslinux/modules/efi64/*.c32 "$mnt"/EFI/BOOT/
|
||||
cp syslinux/{mainmenu,syslinux}.cfg "$mnt"/syslinux
|
||||
cp syslinux/syslx64.cfg "$mnt"/EFI/BOOT
|
||||
|
||||
cleanup_mnt
|
||||
syslinux "$partition"
|
||||
}
|
||||
|
||||
# vim: set ft=sh:
|
@ -0,0 +1,4 @@
|
||||
TIMEOUT 50
|
||||
TOTALTIMEOUT 3000
|
||||
|
||||
INCLUDE /syslinux/items.cfg
|
@ -1,8 +1,4 @@
|
||||
MENU TITLE Legacy boot
|
||||
UI vesamenu.c32
|
||||
TIMEOUT 50
|
||||
TOTALTIMEOUT 3000
|
||||
|
||||
DEFAULT cloud-init-latest
|
||||
|
||||
INCLUDE /syslinux/mainmenu.cfg
|
||||
|
@ -1,8 +1,4 @@
|
||||
MENU TITLE UEFI boot
|
||||
UI vesamenu.c32
|
||||
TIMEOUT 50
|
||||
TOTALTIMEOUT 3000
|
||||
|
||||
DEFAULT cloud-init-latest
|
||||
|
||||
INCLUDE /syslinux/mainmenu.cfg
|
||||
|
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
. syslinux.inc
|
||||
. drive.inc
|
||||
|
||||
function update_syslinux_menu()
|
||||
{
|
||||
local drive="$1"
|
||||
declare -A versions
|
||||
declare -a files
|
||||
local imagepath='/os/focal-maas'
|
||||
|
||||
files=('boot-kernel.', 'boot-initrd.')
|
||||
|
||||
mount_efi "$drive"
|
||||
|
||||
find_newest "$drive"
|
||||
|
||||
if [ -n "$newest" ]; then
|
||||
echo "DEFAULT cloud-init-$newest" >> "$mnt"/items.cfg
|
||||
fi
|
||||
|
||||
partition_list "$drive"
|
||||
for part in $partitions; do
|
||||
version_from_partnum "$drive" "$part"
|
||||
versions["$version"]=1
|
||||
for f in $files; do
|
||||
if [ ! -e "$imagepath"/"$f""$version" ]; then
|
||||
continue
|
||||
fi
|
||||
done
|
||||
cat >> "$mnt"/items.cfg << (EOL)
|
||||
|
||||
LABEL cloud-init-$version
|
||||
MENU LABEL Ubuntu focal (MAAS $version)
|
||||
KERNEL $imagepath/boot-kernel.$version
|
||||
APPEND initrd=$imagepath/boot-initrd.$version root=PARTLABEL="rootfs_$version" ip=dhcp overlayroot=tmpfs:recurse=0 ds=nocloud-net;s=https://box.sysdeploy.org/cloud-init/
|
||||
(EOL)
|
||||
done
|
||||
|
||||
cleanup_mnt
|
||||
}
|
||||
|
||||
# vim: set ft=sh:
|
@ -1,7 +1,7 @@
|
||||
BYT;
|
||||
T_E_M_P:17.2GB:file:512:512:gpt::;
|
||||
1:1049kB:1074MB:1073MB::EFI system partition:boot, legacy_boot, esp;
|
||||
2:1075MB:2147MB:1073MB::root 20210228:;
|
||||
2:1075MB:2147MB:1073MB::root_20210228:;
|
||||
3:2149MB:3221MB:1073MB::root unused:;
|
||||
4:3222MB:4295MB:1073MB::root unused:;
|
||||
5:4296MB:17.2GB:12.9GB::Encrypted:;
|
||||
|
Loading…
Reference in new issue