[Unit]
Description=SSH Key Generation
RequiresMountsFor=/var /var/lib
ConditionPathExists=!/etc/dropbear/dropbear_rsa_host_key
ConditionPathExists=!/var/lib/dropbear/dropbear_rsa_host_key

[Service]
Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
EnvironmentFile=-/etc/default/dropbear
Type=oneshot
ExecStart=/bin/mkdir -p ${DROPBEAR_RSAKEY_DIR}
ExecStart=/usr/sbin/dropbearkey -t rsa -f ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key
RemainAfterExit=yes
