Terminate implementation of metadata in fickit

This commit is contained in:
nemunaire 2023-07-24 19:05:35 +02:00
commit 89d687cd94
4 changed files with 22 additions and 24 deletions

View file

@ -37,14 +37,16 @@ files:
if [ -b /dev/sdb ]; then
DISKS="/dev/sda /dev/sdb"
BOOT_PART=/dev/md2
META_PART=/dev/md3
SWAP_PART=/dev/md1
ROOT_PART=/dev/md0
RAID=1
else
DISKS="/dev/sda"
BOOT_PART=/dev/sda1
SWAP_PART=/dev/sda2
ROOT_PART=/dev/sda3
META_PART=/dev/sda2
SWAP_PART=/dev/sda3
ROOT_PART=/dev/sda4
RAID=0
fi
@ -52,8 +54,9 @@ files:
udhcpc -i eth0
# Retrieve metadata
wget -O /tmp/metadata.json "$(ip r | grep default | awk '{ print $3 }')/fickit-metadata"
/usr/bin/metadata -v file=/tmp/metadata.json
wget -O /tmp/metadata.iso "$(ip r | grep default | awk '{ print $3 }')/fickit-metadata.iso"
mount /tmp/metadata.iso /mnt
/usr/bin/metadata -v file=/mnt/user-data
# Try to detect backend/frontend setup
if ip l | grep eth3 > /dev/null
@ -90,8 +93,9 @@ files:
# Create RAID arrays
if [ "${RAID}" -eq 1 ]; then
/sbin/mdadm --create "${BOOT_PART}" --run --level=1 --metadata=1.0 --raid-devices=2 /dev/sda1 /dev/sdb1
/sbin/mdadm --create "${SWAP_PART}" --run --level=1 --metadata=1.1 --raid-devices=2 /dev/sda2 /dev/sdb2
/sbin/mdadm --create "${ROOT_PART}" --run --level=1 --metadata=0 --raid-devices=2 /dev/sda3 /dev/sdb3
/sbin/mdadm --create "${META_PART}" --run --level=1 --metadata=1.1 --raid-devices=2 /dev/sda2 /dev/sdb2
/sbin/mdadm --create "${SWAP_PART}" --run --level=1 --metadata=1.1 --raid-devices=2 /dev/sda3 /dev/sdb3
/sbin/mdadm --create "${ROOT_PART}" --run --level=1 --metadata=0 --raid-devices=2 /dev/sda4 /dev/sdb4
fi
# Format partitions
@ -111,6 +115,7 @@ files:
/root/install_grub ${DEFAULT_BOOT} "${DISK}"
done
/root/update_imgs "$(ip r | grep default | awk '{ print $3 }')"
dd if=/boot/imgs/fickit-metadata.iso of=${META_PART}
} ||
/bin/ash
@ -217,6 +222,7 @@ files:
- path: etc/sfdisk_schema
contents: |
,500M,U,*
,10M,L,-
,4M,S,-
,+,R,-
mode: "0440"