#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start sshd service if enabled
# ==============================================================================

# If SSH is disabled, use a fake sleep process
if ! bashio::var.has_value "$(bashio::addon.port 22)"; then
    bashio::log.warning "SSH port is disabled. Prevent start of SSH server." 
    exec sleep infinity
fi

bashio::log.info "Starting the SSH daemon..."
exec /usr/sbin/sshd -D -e
