/****************************************************************************** __ ____ __ / / ___ ____ _/ __/_____________ _/ /__ / / / _ \/ __ `/ /_/ ___/ ___/ __ `/ / _ \ / /___/ __/ /_/ / __(__ ) /__/ /_/ / / __/ /_____/\___/\__,_/_/ /____/\___/\__,_/_/\___/ (C)opyright 2025, Leafscale, LLC - https://www.leafscale.com Project: Zygaena Filename: priv.reef Authors: Chris Tusa License: Description: Privilege detection helpers ******************************************************************************/ module util.priv import io.file export // Check if we are running as root (UID 0) fn is_root(): bool end export // Check if we are running as root (UID 0) // Uses file test to check write permission on system directory fn is_root(): bool // Try to create a temp file in /var/lib/coral - only root can write there let test_file = "/var/lib/coral/.root_check" if file.writeFile(test_file, "1") // Successfully wrote - we have root-level access // File will be overwritten next time, no need to delete return true end if return false end is_root end module