#!/usr/bin/ash
# SPDX-License-Identifier: GPL-2.0-only

run_hook() {
    local tinyssh_port
    ! [ -r /etc/tinyssh/tinyssh.initcpio ] || . <(awk '$1 ~ /^tinyssh_port=[0-9]{1,5}$/' /etc/tinyssh/tinyssh.initcpio)

    mount -m -t devpts devpts /dev/pts

    tcpsvd 0 "${tinyssh_port:-222}" tinysshd -v /etc/tinyssh/sshkeydir &
}

run_cleanuphook() {
    killall tcpsvd

    umount /dev/pts
    rm -rf /dev/pts
}

# vim: set ft=sh ts=4 sw=4 et:
