Refactor fickit-update and fickit-prepare

This commit is contained in:
nemunaire 2020-01-30 19:00:46 +01:00
commit bb9dd10f00
2 changed files with 132 additions and 81 deletions

View file

@ -4,29 +4,51 @@ kernel:
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
onboot:
- name: mod
image: linuxkit/modprobe:v0.6
command: ["/bin/sh", "-c", "modprobe e1000e"]
- 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; mkdir -p /boot; ping -W 20 -c 1 10.10.10.6; for p in /dev/sda /dev/sdb; do mount ${p}1 /boot/ && /root/update_imgs; umount /boot; done && sync && reboot -f" ]
capabilities:
- CAP_SYS_ADMIN
- CAP_SYS_BOOT
- CAP_NET_RAW
- CAP_NET_ADMIN
binds:
- /dev:/dev
- /root/update_imgs:/root/update_imgs:ro
- nemunaire/mdadm:18de5ca414227f38a5c0619662077ba5fa26176d
- alpine:latest
files:
- path: /init
contents: |
#!/bin/sh -x
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
mdev -s
mdadm --auto-detect
mdadm --assemble /dev/md2 /dev/sd*1
ip a add 10.10.10.5/29 dev eth0
ip link set eth0 up
mkdir -p /boot
# Wait e1000e launched
if ! ping -W 2 -c 1 10.10.10.6
then
sleep 4
fi
while ! ping -W 10 -c 1 10.10.10.6
do
echo "Unable to contact 10.10.10.6"
echo "Exit the shell when connection established."
/bin/ash
done
mount /dev/md2 /boot/ &&
/root/update_imgs ||
/bin/ash
umount /boot &&
sync &&
reboot -f
/bin/ash
mode: "0755"
- path: root/update_imgs
source: configs/update_imgs.sh
mode: "0755"