mirror of
https://github.com/fosrl/pangolin.git
synced 2025-07-27 06:05:02 +02:00
Allow installer to run without sudo & only need it when need to install Docker
This commit is contained in:
parent
b467d6afa1
commit
56fd366a7d
1 changed files with 10 additions and 7 deletions
|
@ -57,12 +57,6 @@ type Config struct {
|
||||||
func main() {
|
func main() {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
||||||
// check if the user is root
|
|
||||||
if os.Geteuid() != 0 {
|
|
||||||
fmt.Println("This script must be run as root")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
|
||||||
// check if there is already a config file
|
// check if there is already a config file
|
||||||
|
@ -81,6 +75,15 @@ func main() {
|
||||||
moveFile("config/docker-compose.yml", "docker-compose.yml")
|
moveFile("config/docker-compose.yml", "docker-compose.yml")
|
||||||
|
|
||||||
if !isDockerInstalled() && runtime.GOOS == "linux" {
|
if !isDockerInstalled() && runtime.GOOS == "linux" {
|
||||||
|
// Prompt to install Docker if not installed
|
||||||
|
// But only if the user is root, otherwise we exit with an error message
|
||||||
|
if os.Geteuid() != 0 {
|
||||||
|
fmt.Println("Docker is not installed. Please install Docker manually or run this installer as root.")
|
||||||
|
fmt.Println("You can run this installer with 'sudo' to install Docker automatically.")
|
||||||
|
fmt.Println("Exiting...")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
if readBool(reader, "Docker is not installed. Would you like to install it?", true) {
|
if readBool(reader, "Docker is not installed. Would you like to install it?", true) {
|
||||||
installDocker()
|
installDocker()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue