autoreboot: clear one time properties on chassis off

The one-time properties are only meant to last for one boot so ensure
they are reset when the chassis is powered off.

Tested:
root@witherspoon:/lib/systemd/system# busctl set-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/auto_reboot/one_time xyz.openbmc_project.Control.Boot.RebootPolicy AutoReboot b false
root@witherspoon:/lib/systemd/system# busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/auto_reboot/one_time xyz.openbmc_project.Control.Boot.RebootPolicy AutoReboot
b false
root@witherspoon:/lib/systemd/system# systemctl start obmc-chassis-poweroff\@0.target
root@witherspoon:/lib/systemd/system# busctl get-property xyz.openbmc_project.Settings /xyz/openbmc_project/control/host0/auto_reboot/one_time xyz.openbmc_project.Control.Boot.RebootPolicy AutoReboot
b true

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Iece9b7b6027659c550aa5bbf367d253aba4a5634
diff --git a/service_files/phosphor-clear-one-time@.service b/service_files/phosphor-clear-one-time@.service
new file mode 100644
index 0000000..b0bf529
--- /dev/null
+++ b/service_files/phosphor-clear-one-time@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Reset one-time properties on chassis off
+Wants=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot-one_time.service
+After=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot-one_time.service
+
+[Service]
+Restart=no
+Type=oneshot
+ExecStart=/bin/sh -c "busctl set-property `mapper get-service /xyz/openbmc_project/control/host%i/auto_reboot/one_time` /xyz/openbmc_project/control/host%i/auto_reboot/one_time xyz.openbmc_project.Control.Boot.RebootPolicy AutoReboot b true"
+
+[Install]
+WantedBy=obmc-chassis-poweroff@%i.target