2017-01-14 07:01:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
name=$(basename $0)
|
|
|
|
root="$(dirname $(dirname $(dirname $0)))"
|
|
|
|
gomtree=$(readlink -f ${root}/gomtree)
|
2017-01-20 16:29:59 +00:00
|
|
|
t=$(mktemp -t -d go-mtree.XXXXXX)
|
2017-01-14 07:01:36 +00:00
|
|
|
|
2017-01-20 16:16:38 +00:00
|
|
|
setfattr -n user.has.xattrs -v "true" "${t}" || exit 0
|
2017-01-14 07:01:36 +00:00
|
|
|
|
|
|
|
echo "[${name}] Running in ${t}"
|
|
|
|
|
|
|
|
mkdir "${t}/dir"
|
|
|
|
touch "${t}/dir/file"
|
|
|
|
|
|
|
|
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
|
|
|
|
$gomtree -c -k "sha256digest,xattrs" -p ${t}/dir > ${t}/${name}.mtree
|
|
|
|
|
|
|
|
setfattr -n user.mtree.testing -v "bananas and lemons" "${t}/dir/file"
|
|
|
|
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
|
|
|
|
|
|
|
|
setfattr -x user.mtree.testing "${t}/dir/file"
|
|
|
|
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
|
|
|
|
|
|
|
|
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
|
|
|
|
setfattr -n user.mtree.another -v "another a=b" "${t}/dir/file"
|
|
|
|
! $gomtree -p ${t}/dir -f ${t}/${name}.mtree
|
|
|
|
|
|
|
|
setfattr -n user.mtree.testing -v "apples and=bananas" "${t}/dir/file"
|
|
|
|
setfattr -x user.mtree.another "${t}/dir/file"
|
|
|
|
$gomtree -p ${t}/dir -f ${t}/${name}.mtree
|
|
|
|
|
|
|
|
rm -fr ${t}
|