Skip to content

Commit

Permalink
cmd/create: Check if /mnt exists before adding it as a volume mount
Browse files Browse the repository at this point in the history
No /mnt on NixOS.

#676
  • Loading branch information
mjlbach authored and debarshiray committed Feb 20, 2021
1 parent 05c9c06 commit a65fe31
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,19 @@ func createContainer(container, image, release string, showCommandToEnter bool)
}
}

logrus.Debug("Checking if /mnt is a symbolic link to /var/mnt")

var mntLink []string
var mntMount []string

mntPath, _ := filepath.EvalSymlinks("/mnt")
if mntPath == "/var/mnt" {
logrus.Debug("/mnt is a symbolic link to /var/mnt")
mntLink = []string{"--mnt-link"}
} else {
mntMount = []string{"--volume", "/mnt:/mnt:rslave"}
if utils.PathExists("/mnt") {
logrus.Debug("Checking if /mnt is a symbolic link to /var/mnt")

mntPath, _ := filepath.EvalSymlinks("/mnt")
if mntPath == "/var/mnt" {
logrus.Debug("/mnt is a symbolic link to /var/mnt")
mntLink = []string{"--mnt-link"}
} else {
mntMount = []string{"--volume", "/mnt:/mnt:rslave"}
}
}

var runMediaMount []string
Expand Down

0 comments on commit a65fe31

Please sign in to comment.