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-04-15 22:39:18 +00:00
|
|
|
unameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
|
|
return fmt.Sprintf("uname=%s", hdr.Uname), nil
|
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
return "", nil
|
|
|
|
}
|
2016-04-15 22:39:18 +00:00
|
|
|
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
|
|
return fmt.Sprintf("uid=%d", hdr.Uid), nil
|
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
return "", nil
|
|
|
|
}
|
2016-04-15 22:39:18 +00:00
|
|
|
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
|
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
|
|
return fmt.Sprintf("gid=%d", hdr.Gid), nil
|
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
return "", nil
|
|
|
|
}
|
2016-04-15 22:39:18 +00:00
|
|
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
2016-03-16 19:59:34 +00:00
|
|
|
return "", nil
|
|
|
|
}
|
2016-04-15 22:39:18 +00:00
|
|
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (string, error) {
|
2016-03-17 17:54:59 +00:00
|
|
|
return "", nil
|
|
|
|
}
|
2016-03-16 19:59:34 +00:00
|
|
|
)
|