removed mounts.conf and check of env shell

This commit is contained in:
Christian Goll
2023-02-03 15:15:41 +01:00
parent 05237935eb
commit 80687f9475
3 changed files with 16 additions and 11 deletions

View File

@@ -148,8 +148,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
for _, mntPnt := range mountPts {
err = syscall.Mount(mntPnt.Source, path.Join(containerPath, mntPnt.Dest), "", syscall.MS_BIND, "")
if err != nil {
fmt.Printf("BIND ERROR: %s\n", err)
wwlog.Warn("Couldn't mount %s to %s", mntPnt.Source, mntPnt.Dest)
wwlog.Warn("Couldn't mount %s to %s: %s", mntPnt.Source, mntPnt.Dest, err)
} else if mntPnt.ReadOnly {
err = syscall.Mount(mntPnt.Source, path.Join(containerPath, mntPnt.Dest), "", syscall.MS_REMOUNT|syscall.MS_RDONLY|syscall.MS_BIND, "")
if err != nil {

View File

@@ -5,6 +5,7 @@ package shell
import (
"os"
"path"
cntexec "github.com/hpcng/warewulf/internal/app/wwctl/container/exec"
"github.com/hpcng/warewulf/internal/pkg/container"
@@ -27,8 +28,21 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
}
*/
shellName := os.Getenv("SHELL")
if !container.ValidSource(containerName) {
wwlog.Error("Unknown Warewulf container: %s", containerName)
os.Exit(1)
}
var shells []string
if shellName == "" {
shellName = "/usr/bin/bash"
shells = append(shells, "/bin/bash")
} else {
shells = append(shells, shellName, "/bin/bash")
}
for _, s := range shells {
if _, err := os.Stat(path.Join(container.RootFsDir(containerName), s)); err == nil {
shellName = s
break
}
}
args = append(args, shellName)
allargs = append(allargs, args...)

View File

@@ -1,8 +0,0 @@
Mount Points:
- Dest: /etc/SUSEConnect
Source: /etc/SUSEConnect
- Dest: /etc/SUSEConnect
Source: /etc/SUSEConnect
- Dest: /etc/SUSEConnect
Source: /etc/SUSEConnect