Pseudo code

This commit is contained in:
Peter Šurda 2021-02-25 14:50:05 +01:00
parent 5cbcf8714f
commit c0a928cc32
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87
4 changed files with 77 additions and 0 deletions

3
.travis.yml Normal file
View File

@ -0,0 +1,3 @@
---
script:
- test.sh

25
install.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
function setup_bootloader()
{
local dev="$1"
check_if_can_overwrite
check_if_mounted_or_used_in_lvm_md_crypt
wipe_or_nvme_format
parted mklabel gpt
parted mkpart 1GB EFI
parted mkpart 1GB squashfs-1
parted mkpart 1GB squashfs-2
parted mkpart 1GB squashfs-3
dd gptmbr.bin
mkfs.vfat "$dev"1
syslinux "$dev"1
mount
copy_efi_files
create_syslinux_cfg
umount
}
detect_disks
select_disk

3
syslinux.cfg.legacy Normal file
View File

@ -0,0 +1,3 @@
LABEL EFI
CONFIG syslnx64.cfg
APPEND /EFI/BOOT

46
update-boot-files.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
OSCODENAME=focal
OSVERSION=20.04
function find_oldest()
{
echo
}
function get_latest_maas_id()
{
jq blah $OSCODENAME
}
function get_checksum()
{
jq blah $OSVERSION
}
function download_and_verify()
{
local url="$1"
local checksum="$2"
local fname="$3"
wget "$url" -O "$fname"
if [ "checksum" == "$checksum" ]; then
return 0
fi
return 1
}
function download_files()
{
download kernel
download initrd
download squashfs
dd if=squashfs of="$partition" bs=1M
create_options_file
update_default
delete_oldest_if_needed
update_onerror_second_youngest
}