ignition/fix-hybrid-mbr.yaml

37 lines
809 B
YAML

variant: fcos
version: 1.4.0
storage:
files:
- path: /etc/ignition/fix-hybrid-mbr.sh
mode: 0755
contents:
inline: |-
#!/bin/sh
set -ex
bootdev=$(awk '$5=="/boot"{print $10}' /proc/1/mountinfo)
sysdev=$(readlink -e /sys/class/block/${bootdev##*/})
sysdev_parent=${sysdev%/*}
disk=/dev/${sysdev_parent##*/}
sgdisk -h 2:EE "${disk}"
echo type=0c,bootable | sfdisk -Y mbr -N 1 "${disk}"
systemd:
units:
- name: fix-hybrid-mbr.service
contents: |-
[Unit]
Description=Fix Hybrid MBR for Raspberry Pi 2/3
ConditionFirstBoot=yes
[Service]
Type=oneshot
ExecStart=/etc/ignition/fix-hybrid-mbr.sh
[Install]
WantedBy=basic.target
enabled: true