FIXME: Update release in config file when stopping jail

This commit is contained in:
yo 2022-11-20 20:17:59 +01:00
parent 9c18a83ee8
commit 89db166040

View File

@ -228,14 +228,24 @@ func StopJail(args []string) {
fmt.Printf("Error getting jail: %s\n", err)
continue
}
if cj.Running == false {
fmt.Printf("Jail %s is not running!\n", cj.Name)
continue
}
fmt.Printf("> Stopping jail %s\n", a)
// Get current version to update config.json
cvers, err := executeCommandInJail(cj, "/bin/freebsd-version")
if err != nil {
fmt.Printf("ERROR: %s\n", err.Error())
return
}
cvers = strings.TrimRight(cvers, "\n")
fmt.Sprintf(cj.Config.Release, cvers)
cj.ConfigUpdated = true
out, err := executeCommand(fmt.Sprintf("rctl jail:%s", cj.InternalName))
if err == nil && len(out) > 0 {
fmt.Printf(" > Remove RCTL rules:\n")
@ -399,5 +409,8 @@ func StopJail(args []string) {
}
}
}
WriteConfigToDisk(cj.Name, false, true)
}
}