Re: "Allow installer to run without sudo & only need it when need to install Docker"

This commit is contained in:
Socheat Sok 2025-05-29 21:55:50 +07:00
parent 6f3514199a
commit c997b8625f
No known key found for this signature in database
GPG key ID: 8967527396F3D1B5

View file

@ -58,9 +58,11 @@ func main() {
reader := bufio.NewReader(os.Stdin) reader := bufio.NewReader(os.Stdin)
// check if the user is root // check if the user is root
if os.Geteuid() != 0 { if !isDockerInstalled() {
fmt.Println("This script must be run as root") if os.Geteuid() != 0 {
os.Exit(1) fmt.Println("Docker is not installed. Please install Docker manually or run this installer as root.")
os.Exit(1)
}
} }
var config Config var config Config