#!/sbin/openrc-run

description="Bee: run hardware audit (debug mode — SSH stays up after)"

depend() {
    need localmount
    after bee-network
}

start() {
    ebegin "Running hardware audit"
    /usr/local/bin/audit --output stdout > /var/log/bee-audit.json 2>/var/log/bee-audit.log
    local rc=$?
    if [ $rc -eq 0 ]; then
        einfo "Audit complete: /var/log/bee-audit.json"
        einfo "SSH in and inspect results. Dropbear is running."
    else
        ewarn "Audit finished with errors — check /var/log/bee-audit.log"
    fi
    eend 0
}
