Files
runtime/apps/daemon/pkg/common/get_shell.go
zeekay ea80dc3638 feat: Add new Dockerfiles and improve containerization
- Add main Dockerfile for production builds
- Add Dockerfile.runtime for secure code execution
- Add Dockerfile.runtime.fixed with improved configuration
- Include .dockerignore for build optimization
- Add integration documentation and publishing guides
- Update API and CLI components for better runtime support
- Enhance sandbox and container management features
2025-08-16 23:03:39 -05:00

42 lines
675 B
Go

// Copyright 2025 Hanzo Industries Inc.
// SPDX-License-Identifier: AGPL-3.0
package common
import (
"os"
"os/exec"
"strings"
)
func GetShell() string {
out, err := exec.Command("sh", "-c", "grep '^[^#]' /etc/shells").Output()
if err != nil {
return "sh"
}
if strings.Contains(string(out), "/usr/bin/zsh") {
return "/usr/bin/zsh"
}
if strings.Contains(string(out), "/bin/zsh") {
return "/bin/zsh"
}
if strings.Contains(string(out), "/usr/bin/bash") {
return "/usr/bin/bash"
}
if strings.Contains(string(out), "/bin/bash") {
return "/bin/bash"
}
shellEnv, shellSet := os.LookupEnv("SHELL")
if shellSet {
return shellEnv
}
return "sh"
}