mkinitcpio-dropbear/dropbear_hook
2022-01-24 15:26:02 -05:00

28 lines
709 B
Bash

#!/usr/bin/ash
run_hook ()
{
[ -d /dev/pts ] || mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
echo "Starting dropbear"
# Configuration processing and dropbear execution is done in a subshell
# to prevent dropbear.conf from inadvertently clobbering important variables
# or terminating the shell that is running /init.
(
# Load configuration options (currently only default listen address)
[ -r /etc/dropbear/dropbear.conf ] && . /etc/dropbear/dropbear.conf
/usr/sbin/dropbear -E -s -j -k -p "${dropbear_listen:-22}"
)
}
run_cleanuphook ()
{
umount /dev/pts
rm -R /dev/pts
if [ -f /var/run/dropbear.pid ]; then
kill `cat /var/run/dropbear.pid`
fi
}