server/fickit-prepare.yml

114 lines
3.6 KiB
YAML
Raw Normal View History

2018-12-10 01:16:07 +00:00
kernel:
# image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-amd64
image: nemunaire/kernel:4.9.77
cmdline: "console=ttyS0 console=tty0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
onboot:
- name: net-setup
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 10.10.10.5/29 dev eth0; ip link set eth0 up;" ]
- name: format
image: linuxkit/format:v0.6
command: ["/bin/sh", "-c", "cat /etc/fdisk_cmd | fdisk /dev/sda && cat /etc/fdisk_cmd | fdisk /dev/sdb && cat /etc/sfdisk_schema | sfdisk /dev/sda && cat /etc/sfdisk_schema | sfdisk /dev/sdb" ]
binds:
- /dev:/dev
- /etc/fdisk_cmd:/etc/fdisk_cmd:ro
- /etc/sfdisk_schema:/etc/sfdisk_schema:ro
- name: raid-setup
image: nemunaire/mdadm:90509bdc0a6ee2bb36635ddc2573ae50130f0f04
command: ["/sbin/mdadm", "--create", "/dev/md0", "--run", "--level=1", "--metadata=0", "--raid-devices=2", "/dev/sda3", "/dev/sdb3" ]
- name: format
image: linuxkit/format:v0.6
command: ["/bin/sh", "-c", "mkswap /dev/sda2; mkswap /dev/sdb2; mkfs.ext4 /dev/md0 && sync" ]
binds:
- /dev:/dev
- name: install-syslinux
image: nemunaire/syslinux:876bf253b5e2db33fe64f5ffa796e5e8609a6792
command: ["/bin/sh", "/root/install_syslinux", "/dev/sda" , "/dev/sdb" ]
binds:
- /dev:/dev
- /root/install_syslinux:/root/install_syslinux:ro
- /root/update_imgs:/root/update_imgs:ro
files:
- path: root/update_imgs
source: configs/update_imgs.sh
mode: "0755"
- path: root/install_syslinux
contents: |
#!/bin/sh
for p; do
mkfs.vfat ${p}1
mkdir -p /boot
mount ${p}1 /boot/
mkdir -p /boot/EFI/boot /boot/imgs
cd /usr/share/syslinux/efi64
cp ldlinux.e64 menu.c32 libcom32.c32 libutil.c32 vesamenu.c32 poweroff.c32 /boot/EFI/boot
cp syslinux.efi /boot/EFI/boot/bootx64.efi
cat <<EOF > /boot/syslinux.cfg
TIMEOUT 30
ONTIMEOUT backend
MENU background #00000000 * *
MENU color title * #FF22BBCC *
MENU color sel * #FFFFFFFF #FF22BBCC *
MENU color hotsel 1;7;37;40 #ffffffff #76a1d0ff *
UI vesamenu.c32
MENU TITLE Server FIC Challenge
LABEL backend
MENU LABEL FIC Backend
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-boot-initrd.img
APPEND console=ttyS0 console=tty0 root=fickit-backend-squashfs.img
LABEL frontend
MENU LABEL FIC Frontend
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-boot-initrd.img
APPEND console=ttyS0 console=tty0 root=fickit-frontend-squashfs.img
LABEL update
MENU LABEL Update images
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-update-initrd.img
APPEND console=ttyS0 console=tty0
MENU SEPARATOR
LABEL poweroff
MENU LABEL ^Shutdown
KERNEL poweroff.c32
EOF
# BIOS part
dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/mbr.bin of=${p}
syslinux --install ${p}1
cp /usr/share/syslinux/libcom32.c32 /usr/share/syslinux/libutil.c32 /usr/share/syslinux/poweroff.c32 /usr/share/syslinux/vesamenu.c32 /boot/
# Write images
/root/update_imgs
done
mode: "0550"
- path: etc/sfdisk_schema
contents: |
,500M,U,*
,4M,S,-
,+,R,-
mode: "0440"
- path: etc/fdisk_cmd
contents: |
o
w
mode: "0440"