updateVersion now can be used on stopped jail
This commit is contained in:
parent
c2277ce10c
commit
44b877eae1
19
cmd/utils.go
19
cmd/utils.go
@ -474,6 +474,8 @@ func executeCommandWithOutputToStdout(cmdline string) (error) {
|
||||
word = word + string(c)
|
||||
}
|
||||
|
||||
log.Debugf("executeCommandWithOutputToStdout: will execute \"%s\"\n", strings.Join(cmd, " "))
|
||||
|
||||
var execHandle *exec.Cmd
|
||||
if len(cmd) > 1 {
|
||||
execHandle = exec.Command(cmd[0], cmd[1:]...)
|
||||
@ -1062,7 +1064,7 @@ func getJailFromArray(name string, jailtypes []string, jarray []Jail) (*Jail, er
|
||||
var jails []Jail
|
||||
|
||||
if (len(jailtypes) == 1 && len(jailtypes[0]) == 0) || len(jailtypes) == 0 {
|
||||
jailtypes = []string{"jail", "basetpl"}
|
||||
jailtypes = []string{"basejail", "jail", "template"}
|
||||
}
|
||||
|
||||
if strings.Contains(name, "/") {
|
||||
@ -1128,16 +1130,25 @@ func setJailConfigUpdated(jail *Jail) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getVersion(jail *Jail) (string, error) {
|
||||
cvers, err := executeCommand(fmt.Sprintf("%s/bin/freebsd-version", jail.RootPath))
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: %s\n", err.Error())
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimRight(cvers, "\n"), nil
|
||||
}
|
||||
|
||||
func updateVersion(jail *Jail) error {
|
||||
cvers, err := executeCommandInJail(jail, "/bin/freebsd-version")
|
||||
cvers, err := executeCommand(fmt.Sprintf("%s/bin/freebsd-version", jail.RootPath))
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: %s\n", err.Error())
|
||||
return err
|
||||
}
|
||||
cvers = strings.TrimRight(cvers, "\n")
|
||||
jail.Config.Release = cvers
|
||||
writeConfigToDisk(jail, false)
|
||||
|
||||
jail.WriteConfigToDisk(false)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user