2021-03-02 15:45:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. maas-images.inc
|
|
|
|
. syslinux-menu.inc
|
|
|
|
|
|
|
|
function download_version()
|
|
|
|
{
|
|
|
|
local release_version="$1"
|
|
|
|
local drive="$2"
|
|
|
|
local target
|
|
|
|
|
|
|
|
find_unused "$drive"
|
|
|
|
target="$unused"
|
|
|
|
if [ -z "$unused" ]; then
|
|
|
|
find_oldest "$drive"
|
|
|
|
target="$unused"
|
|
|
|
fi
|
|
|
|
if [ -z "$target" ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
downloads="$(mktemp -d)"
|
|
|
|
pushd "$downloads"
|
|
|
|
|
|
|
|
download_and_verify "$release_version" boot-kernel
|
2021-03-02 17:00:17 +01:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
popd
|
|
|
|
rm -rf "$downloads"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
download_and_verify "$release_version" boot-initrd
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
popd
|
|
|
|
rm -rf "$downloads"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-03-02 15:45:59 +01:00
|
|
|
download_and_verify "$release_version" squashfs
|
2021-03-02 17:00:17 +01:00
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
popd
|
|
|
|
rm -rf "$downloads"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-03-02 15:45:59 +01:00
|
|
|
|
|
|
|
mount_efi "$drive"
|
2021-03-02 20:00:26 +01:00
|
|
|
mkdir -p "$mnt""$imagepath"
|
|
|
|
mv boot-initrd "$mnt""$imagepath"/boot-initrd."$release_version"
|
|
|
|
mv boot-kernel "$mnt""$imagepath"/boot-kernel."$release_version"
|
2021-03-02 15:45:59 +01:00
|
|
|
umount_efi
|
|
|
|
|
|
|
|
dev_from_partnum "$drive" "$target"
|
|
|
|
dd if=squashfs of="$partition" bs=1M
|
|
|
|
rename_partition "$drive" "$target" root_"$release_version"
|
|
|
|
rm -f squashfs
|
|
|
|
popd
|
|
|
|
rmdir "$downloads"
|
|
|
|
update_syslinux_menu "$drive"
|
|
|
|
}
|
|
|
|
|
|
|
|
# vim: set ft=sh:
|