From 7f9c8b1c1cc35ab83348f5c094b8c5e4133503b0 Mon Sep 17 00:00:00 2001 From: xSmurf Date: Mon, 29 Jun 2015 20:32:06 +0000 Subject: [PATCH] Changed initpath and clientpath to use single install path prefix instead --- cmd/oz-setup/main.go | 4 +++- config.go | 8 +++----- oz-daemon/launch.go | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/oz-setup/main.go b/cmd/oz-setup/main.go index dd0ef09..d26c613 100644 --- a/cmd/oz-setup/main.go +++ b/cmd/oz-setup/main.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "os/exec" + "path" "reflect" "strconv" "strings" @@ -217,7 +218,8 @@ func handleInstall(c *cli.Context) { os.Exit(1) } - err = syscall.Symlink(OzConfig.ClientPath, cpath) + clientbin := path.Join(OzConfig.PrefixPath, "bin", "oz") + err = syscall.Symlink(clientbin, cpath) if err != nil { fmt.Fprintf(os.Stderr, "Failed to create symlink %s", err) os.Exit(1) diff --git a/config.go b/config.go index 024d8a4..e84e0ce 100644 --- a/config.go +++ b/config.go @@ -12,12 +12,11 @@ import ( type Config struct { ProfileDir string `json:"profile_dir" desc:"Directory containing the sandbox profiles"` ShellPath string `json:"shell_path" desc:"Path of the shell using when entering a sandbox"` - InitPath string `json:"init_path" desc:"Path to the 'oz-init' binary"` - ClientPath string `json:"client_path" desc:"Path to the 'oz' client binary "` + PrefixPath string `json:"prefix_path" desc:"Prefix path containing the oz executables"` SandboxPath string `json:"sandbox_path" desc:"Path of the sandboxes base"` BridgeMACAddr string `json:"bridge_mac" desc:"MAC Address of the bridge interface"` DivertSuffix string `json:"divert_suffix" desc:"Suffix using for dpkg-divert of application executables"` - NMIgnoreFile string `json:"nm_ignore_file" desc:"Path to the NetworkManager ignore config file"` + NMIgnoreFile string `json:"nm_ignore_file" desc:"Path to the NetworkManager ignore config file, disables the warning if empty"` UseFullDev bool `json:"use_full_dev" desc:"Give sandboxes full access to devices instead of a restricted set"` AllowRootShell bool `json:"allow_root_shell" desc:"Allow entering a sandbox shell as root"` LogXpra bool `json:"log_xpra" desc:"Log output of Xpra"` @@ -31,8 +30,7 @@ func NewDefaultConfig() *Config { return &Config{ ProfileDir: "/var/lib/oz/cells.d", ShellPath: "/bin/bash", - InitPath: "/usr/local/bin/oz-init", - ClientPath: "/usr/local/bin/oz", + PrefixPath: "/usr/local", SandboxPath: "/srv/oz", NMIgnoreFile: "/etc/NetworkManager/conf.d/oz.conf", BridgeMACAddr: "6A:A8:2E:56:E8:9C", diff --git a/oz-daemon/launch.go b/oz-daemon/launch.go index cb04984..31dea3a 100644 --- a/oz-daemon/launch.go +++ b/oz-daemon/launch.go @@ -121,7 +121,8 @@ func (d *daemonState) launch(p *oz.Profile, msg *LaunchMsg, uid, gid uint32, log if err != nil { return nil, fmt.Errorf("Failed to create random socket path: %v", err) } - cmd := createInitCommand(d.config.InitPath, p.Name, socketPath, msg.Env, uid, display, stn) + initPath := path.Join(d.config.PrefixPath, "bin", "oz-init") + cmd := createInitCommand(initPath, p.Name, socketPath, msg.Env, uid, display, stn) log.Debug("Command environment: %+v", cmd.Env) pp, err := cmd.StderrPipe() if err != nil {