# Rootfs Elemental OEM configuration file
#
# This file is part of Elemental and will get reset during upgrades.
#
# Before you change this file manually,
# consider copying this file to /usr/local/cloud-config or
# copy the file with a prefix starting by 90, e.g. /oem/91_custom.yaml
name: "Rootfs Layout Settings"
stages:
  rootfs.before:
    - name: "Pull data from provider"
      datasource:
        providers: ["aws", "gcp", "openstack", "cdrom"]
        path: "/oem"
  initramfs:
    - if: '[ ! -f "/run/elemental/recovery_mode" ]'
      name: "Persist /etc/machine-id"
      commands:
      - |
        # persist machine-id
        if [ -s /run/elemental/persistent/etc/machine-id ]; then
          cat /run/elemental/persistent/etc/machine-id > /etc/machine-id
        else
          mkdir -p /run/elemental/persistent/etc
          cp /etc/machine-id /run/elemental/persistent/etc
        fi
