mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-25 01:25:39 +00:00
Vincent Batts
68651d77d6
Fixes: #128 Reported-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
// +build !linux,!darwin,!freebsd,!netbsd,!openbsd
|
|
|
|
package mtree
|
|
|
|
import (
|
|
"archive/tar"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
// 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) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return KeyVal(fmt.Sprintf("uname=%s", hdr.Uname)), nil
|
|
}
|
|
return emptyKV, nil
|
|
}
|
|
gnameKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return KeyVal(fmt.Sprintf("gname=%s", hdr.Gname)), nil
|
|
}
|
|
return emptyKV, nil
|
|
}
|
|
uidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return KeyVal(fmt.Sprintf("uid=%d", hdr.Uid)), nil
|
|
}
|
|
return emptyKV, nil
|
|
}
|
|
gidKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
if hdr, ok := info.Sys().(*tar.Header); ok {
|
|
return KeyVal(fmt.Sprintf("gid=%d", hdr.Gid)), nil
|
|
}
|
|
return emptyKV, nil
|
|
}
|
|
nlinkKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
return emptyKV, nil
|
|
}
|
|
xattrKeywordFunc = func(path string, info os.FileInfo, r io.Reader) (KeyVal, error) {
|
|
return emptyKV, nil
|
|
}
|
|
)
|