Add default gateway, execute exec_start
This commit is contained in:
parent
f29aeb2e23
commit
e1f6b4f6f9
35
cmd/start.go
35
cmd/start.go
@ -1300,6 +1300,27 @@ func StartJail(args []string) {
|
|||||||
}
|
}
|
||||||
fmt.Printf(" > Setup VNet network: OK\n")
|
fmt.Printf(" > Setup VNet network: OK\n")
|
||||||
|
|
||||||
|
// TODO: Handle DHCP
|
||||||
|
fmt.Printf(" > Setup default ipv4 gateway:\n")
|
||||||
|
cmd := fmt.Sprintf("/usr/sbin/setfib %s /usr/sbin/jexec %d route add default %s", cj.Config.Exec_fib, cj.JID, cj.Config.Defaultrouter)
|
||||||
|
out, err := executeCommand(cmd)
|
||||||
|
if err == nil && len(out) > 0 {
|
||||||
|
fmt.Printf("Error: %v: %s\n", err, out)
|
||||||
|
} else {
|
||||||
|
fmt.Printf(" > Setup default ipv4 gateway: OK\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
if cj.Config.Ip6_addr != "none" {
|
||||||
|
fmt.Printf(" > Setup default ipv6 gateway:\n")
|
||||||
|
cmd := fmt.Sprintf("/usr/sbin/setfib %s /usr/sbin/jexec %d route add -6 default %s", cj.Config.Exec_fib, cj.JID, cj.Config.Defaultrouter6)
|
||||||
|
out, err := executeCommand(cmd)
|
||||||
|
if err == nil && len(out) > 0 {
|
||||||
|
fmt.Printf("Error: %v: %s\n", err, out)
|
||||||
|
} else {
|
||||||
|
fmt.Printf(" > Setup default ipv6 gateway: OK\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
err = jailZfsDatasets(cj)
|
err = jailZfsDatasets(cj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1311,10 +1332,20 @@ func StartJail(args []string) {
|
|||||||
// TODO
|
// TODO
|
||||||
//generateResolvConf(cj)
|
//generateResolvConf(cj)
|
||||||
|
|
||||||
|
// Start services
|
||||||
|
if len(cj.Config.Exec_start) > 0 {
|
||||||
|
fmt.Printf(" > Start services:\n")
|
||||||
|
cmd := fmt.Sprintf("/usr/sbin/setfib %s /usr/sbin/jexec %d %s", cj.Config.Exec_fib, cj.JID, cj.Config.Exec_start)
|
||||||
|
out, err := executeCommand(cmd)
|
||||||
|
if err == nil && len(out) > 0 {
|
||||||
|
fmt.Printf("Error: %v: %s\n", err, out)
|
||||||
|
} else {
|
||||||
|
fmt.Printf(" > Start services: OK\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO : Start services
|
// TODO: Execute Exec_poststart
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
out, err := executeCommand(fmt.Sprintf("rctl jail:%s", cj.InternalName))
|
out, err := executeCommand(fmt.Sprintf("rctl jail:%s", cj.InternalName))
|
||||||
|
Loading…
Reference in New Issue
Block a user