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
|
2017-06-15 18:54:58 +00:00
|
|
|
flagsKeywordFunc = func(path string, info os.FileInfo, r io.Reader) ([]KeyVal, error) {
|
|
|
|
return nil, nil
|
2016-12-08 03:10:00 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
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 {
|
2017-06-15 18:54:58 +00:00
|
|
|
return []KeyVal{KeyVal(fmt.Sprintf("uname=%s", hdr.Uname))}, nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
return nil, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
gnameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) ([]KeyVal, error) {
|
2017-06-15 15:59:27 +00:00
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
2017-06-15 18:54:58 +00:00
|
|
|
return []KeyVal{KeyVal(fmt.Sprintf("gname=%s", hdr.Gname))}, nil
|
2017-06-15 15:59:27 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
return nil, nil
|
2017-06-15 15:59:27 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +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 {
|
2017-06-15 18:54:58 +00:00
|
|
|
return []KeyVal{KeyVal(fmt.Sprintf("uid=%d", hdr.Uid))}, nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
return nil, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +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 {
|
2017-06-15 18:54:58 +00:00
|
|
|
return []KeyVal{KeyVal(fmt.Sprintf("gid=%d", hdr.Gid))}, nil
|
2016-04-15 22:39:18 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
return nil, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) ([]KeyVal, error) {
|
|
|
|
return nil, nil
|
2016-03-16 19:59:34 +00:00
|
|
|
}
|
2017-06-15 18:54:58 +00:00
|
|
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) ([]KeyVal, error) {
|
|
|
|
return nil, nil
|
2016-03-17 17:54:59 +00:00
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
)
|