[Unit]
Description=Bind mount volatile /etc/hostname
DefaultDependencies=false
Before=local-fs.target
RequiresMountsFor=/var/volatile /etc
ConditionPathIsReadWrite=/var/volatile
ConditionPathExists=/etc/hostname
ConditionPathIsReadWrite=!/etc/hostname

[Service]
Type=oneshot
RemainAfterExit=Yes
StandardOutput=syslog
TimeoutSec=0
ExecStart=/sbin/mount-copybind /var/volatile/hostname /etc/hostname
ExecStop=/bin/umount /etc/hostname

[Install]
WantedBy=local-fs.target
