コード例 #1
0
ファイル: init.go プロジェクト: tdr130/oz
func (st *initState) bindWhitelist(fsys *fs.Filesystem, wlist []oz.WhitelistItem) error {
	if wlist == nil {
		return nil
	}
	for _, wl := range wlist {
		flags := 0
		if wl.CanCreate {
			flags |= fs.BindCanCreate
		}
		if wl.Ignore {
			flags |= fs.BindIgnore
		}
		if wl.ReadOnly {
			flags |= fs.BindReadOnly
		}
		if wl.Force {
			flags |= fs.BindForce
		}
		if wl.NoFollow {
			flags |= fs.BindNoFollow
		}
		if wl.Path == "" {
			continue
		}
		if err := fsys.BindTo(wl.Path, wl.Target, flags, st.display, st.user); err != nil {
			return err
		}
	}
	return nil
}