name: machine-config-daemon-firstboot.service
enabled: true
contents: |
  [Unit]
  Description=Machine Config Daemon Firstboot
  # Make sure it runs only on OSTree booted system
  ConditionPathExists=/run/ostree-booted
  # Removal of this file signals firstboot completion
  ConditionPathExists=/etc/ignition-machine-config-encapsulated.json
  After=machine-config-daemon-pull.service
  Before=crio.service crio-wipe.service
  Before=kubelet.service

  [Service]
  Type=oneshot
  RemainAfterExit=yes
  # Disable existing repos (if any) so that OS extensions would use embedded RPMs only
  ExecStartPre=-/usr/bin/sh -c "sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/*.repo"
  ExecStart=/run/bin/machine-config-daemon firstboot-complete-machineconfig
  {{if .Proxy -}}
  EnvironmentFile=/etc/mco/proxy.env
  {{end -}}

  [Install]
  WantedBy=multi-user.target
  RequiredBy=crio.service kubelet.service
