xref: /OK3568_Linux_fs/buildroot/package/dropbear/dropbear.service (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun[Unit]
2*4882a593SmuzhiyunDescription=Dropbear SSH daemon
3*4882a593SmuzhiyunAfter=syslog.target network.target auditd.service
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun[Service]
6*4882a593Smuzhiyun# If /etc/dropbear is a symlink to /var/run/dropbear, and
7*4882a593Smuzhiyun#   - the filesystem is RO (i.e. we can not rm the symlink),
8*4882a593Smuzhiyun#     create the directory pointed to by the symlink.
9*4882a593Smuzhiyun#   - the filesystem is RW (i.e. we can rm the symlink),
10*4882a593Smuzhiyun#     replace the symlink with an actual directory
11*4882a593SmuzhiyunExecStartPre=/bin/sh -c '\
12*4882a593Smuzhiyunif [ -L /etc/dropbear \
13*4882a593Smuzhiyun     -a "$(readlink /etc/dropbear)" = "/var/run/dropbear" ]; then \
14*4882a593Smuzhiyun    if rm -f /etc/dropbear >/dev/null 2>&1; then \
15*4882a593Smuzhiyun        mkdir -p /etc/dropbear; \
16*4882a593Smuzhiyun    else \
17*4882a593Smuzhiyun        echo "No persistent location to store SSH host keys. New keys will be"; \
18*4882a593Smuzhiyun        echo "generated at each boot. Are you sure this is what you want to do?"; \
19*4882a593Smuzhiyun        mkdir -p "$(readlink /etc/dropbear)"; \
20*4882a593Smuzhiyun    fi; \
21*4882a593Smuzhiyunfi'
22*4882a593SmuzhiyunEnvironmentFile=-/etc/default/dropbear
23*4882a593SmuzhiyunExecStart=/usr/sbin/dropbear -F -R $DROPBEAR_ARGS
24*4882a593SmuzhiyunExecReload=/bin/kill -HUP $MAINPID
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun[Install]
27*4882a593SmuzhiyunWantedBy=multi-user.target
28