|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
"bufio"
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
|
|
|
|
"io/ioutil"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"os/exec"
|
|
|
@ -63,6 +64,17 @@ func Main() {
|
|
|
|
|
|
|
|
|
|
|
|
func parseArgs() *initState {
|
|
|
|
func parseArgs() *initState {
|
|
|
|
log := createLogger()
|
|
|
|
log := createLogger()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if os.Getuid() != 0 {
|
|
|
|
|
|
|
|
log.Error("oz-init must run as root\n")
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pcontents, _ := ioutil.ReadFile("/proc/1/cmdline")
|
|
|
|
|
|
|
|
if len(pcontents) > 0 {
|
|
|
|
|
|
|
|
log.Error("What are you doing? Oz-init cannot be launched manually")
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getvar := func(name string) string {
|
|
|
|
getvar := func(name string) string {
|
|
|
|
val := os.Getenv(name)
|
|
|
|
val := os.Getenv(name)
|
|
|
|
if val == "" {
|
|
|
|
if val == "" {
|
|
|
|