Merge branch 'master' of ssh://github.com/subgraph/oz

master
xSmurf 10 years ago
commit 94f84a0063

@ -7,6 +7,7 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"strings" "strings"
"os"
) )
func resolvePath(p string, u *user.User) ([]string, error) { func resolvePath(p string, u *user.User) ([]string, error) {
@ -25,7 +26,15 @@ func resolveVars(p string, u *user.User) (string, error) {
switch { switch {
case strings.HasPrefix(p, pathVar): case strings.HasPrefix(p, pathVar):
emptyPath := false
if os.Getenv("PATH") == "" {
emptyPath = true
os.Setenv("PATH", "/bin:/usr/bin:/sbin:/usr/sbin")
}
resolved, err := exec.LookPath(p[len(pathVar):]) resolved, err := exec.LookPath(p[len(pathVar):])
if emptyPath {
os.Unsetenv("PATH")
}
if err != nil { if err != nil {
return "", fmt.Errorf("failed to resolve %s", p) return "", fmt.Errorf("failed to resolve %s", p)
} }

@ -10,7 +10,6 @@ import (
"github.com/subgraph/oz/network" "github.com/subgraph/oz/network"
"github.com/op/go-logging" "github.com/op/go-logging"
"github.com/subgraph/oz/fs"
"os" "os"
"path" "path"
) )
@ -87,12 +86,6 @@ func initialize() *daemonState {
} }
} }
rootfs := path.Join(config.SandboxPath, "rootfs")
fs := fs.NewFilesystem(config, d.log)
d.log.Info("Creating root filesystem at %s", rootfs)
if err := setupRootfs(fs); err != nil {
d.log.Fatalf("Failed setting up root filesystem: %v", err)
}
sockets := path.Join(config.SandboxPath, "sockets") sockets := path.Join(config.SandboxPath, "sockets")
if err := os.MkdirAll(sockets, 0755); err != nil { if err := os.MkdirAll(sockets, 0755); err != nil {
d.log.Fatalf("Failed to create sockets directory: %v", err) d.log.Fatalf("Failed to create sockets directory: %v", err)

@ -503,8 +503,13 @@ func (st *initState) childrenVector() []*exec.Cmd {
} }
func (st *initState) setupFilesystem(extra []oz.WhitelistItem) error { func (st *initState) setupFilesystem(extra []oz.WhitelistItem) error {
fs := fs.NewFilesystem(st.config, st.log) fs := fs.NewFilesystem(st.config, st.log)
if err := setupRootfs(fs); err != nil {
return err
}
if err := st.bindWhitelist(fs, st.profile.Whitelist); err != nil { if err := st.bindWhitelist(fs, st.profile.Whitelist); err != nil {
return err return err
} }

@ -1,4 +1,4 @@
package daemon package ozinit
import ( import (
"fmt" "fmt"
Loading…
Cancel
Save