2016-10-31 14:10:42 +00:00
|
|
|
// +build !linux,!darwin,!freebsd,!netbsd,!openbsd
|
2016-03-16 19:59:34 +00:00
|
|
|
|
|
|
|
package mtree
|
|
|
|
|
2016-04-15 22:39:18 +00:00
|
|
|
import (
|
|
|
|
"archive/tar"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"os"
|
|
|
|
)
|
2016-03-16 19:59:34 +00:00
|
|
|
|
|
|
|
var (
|
2016-12-08 03:10:00 +00:00
|
|
|
// this is bsd specific https://www.freebsd.org/cgi/man.cgi?query=chflags&sektion=2
|
|
|
|
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
|
|
return emptyKV, nil
|
|
|
|
}
|
|
|
|
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
2016-04-15 22:39:18 +00:00
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
2016-12-08 03:10:00 +00:00
|
|
|
return KeyVal(fmt.Sprintf("uname=%s", hdr.Uname)), nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
return emptyKV, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
2016-04-15 22:39:18 +00:00
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
2016-12-08 03:10:00 +00:00
|
|
|
return KeyVal(fmt.Sprintf("uid=%d", hdr.Uid)), nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
return emptyKV, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
2016-04-15 22:39:18 +00:00
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
2016-12-08 03:10:00 +00:00
|
|
|
return KeyVal(fmt.Sprintf("gid=%d", hdr.Gid)), nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
return emptyKV, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
|
|
return emptyKV, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2016-12-08 03:10:00 +00:00
|
|
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
|
|
return emptyKV, nil
|
2016-03-17 17:54:59 +00:00
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
)
|