@ -71,8 +71,8 @@ func (fs *Filesystem) newItem(path, target string, readonly bool) (*mountItem, e
} , nil
} , nil
}
}
func NewFromProfile ( profile * oz . Profile , user * user . User , log * logging . Logger ) * Filesystem {
func NewFromProfile ( profile * oz . Profile , user * user . User , basePath string , log * logging . Logger ) * Filesystem {
fs := NewFilesystem ( profile . Name , user , log)
fs := NewFilesystem ( profile . Name , user , basePath, log)
for _ , wl := range profile . Whitelist {
for _ , wl := range profile . Whitelist {
fs . addWhitelist ( wl . Path , wl . Path , wl . ReadOnly )
fs . addWhitelist ( wl . Path , wl . Path , wl . ReadOnly )
}
}
@ -87,14 +87,14 @@ func NewFromProfile(profile *oz.Profile, user *user.User, log *logging.Logger) *
return fs
return fs
}
}
func NewFilesystem ( name string , user * user . User , log * logging . Logger ) * Filesystem {
func NewFilesystem ( name string , user * user . User , basePath string , log * logging . Logger ) * Filesystem {
fs := new ( Filesystem )
fs := new ( Filesystem )
fs . log = log
fs . log = log
fs . name = name
fs . name = name
if log == nil {
if log == nil {
fs . log = logging . MustGetLogger ( "oz" )
fs . log = logging . MustGetLogger ( "oz" )
}
}
fs . base = path . Join ( "/srv/oz" , name )
fs . base = path . Join ( basePath , name )
fs . root = path . Join ( fs . base , "rootfs" )
fs . root = path . Join ( fs . base , "rootfs" )
fs . user = user
fs . user = user
fs . userID = strconv . Itoa ( os . Getuid ( ) )
fs . userID = strconv . Itoa ( os . Getuid ( ) )