mirror of
https://github.com/mgree/ffs.git
synced 2024-08-16 23:00:48 +03:00
40 lines
738 B
Bash
40 lines
738 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
fail() {
|
||
|
echo FAILED: $1
|
||
|
if [ "$MNT" ]
|
||
|
then
|
||
|
rm -r "$MNT"
|
||
|
fi
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
if [ "$RUNNER_OS" = "Linux" ] || [ "$(uname)" = "Linux" ]; then
|
||
|
which setfattr || fail setfattr
|
||
|
rmattr() {
|
||
|
attr=$1
|
||
|
shift
|
||
|
setfattr -x "$attr" "$@"
|
||
|
}
|
||
|
elif [ "$RUNNER_OS" = "macOS" ] || [ "$(uname)" = "Darwin" ]; then
|
||
|
rmattr() {
|
||
|
attr=$1
|
||
|
shift
|
||
|
xattr -d "$attr" "$@"
|
||
|
}
|
||
|
else
|
||
|
fail os
|
||
|
fi
|
||
|
|
||
|
MNT=$(mktemp -d)
|
||
|
|
||
|
unpack --into "$MNT" ../json/object.json || fail unpack
|
||
|
|
||
|
rmattr user.type "$MNT" || fail "root user.type"
|
||
|
rmattr user.fake "$MNT" && fail "root user.fake"
|
||
|
rmattr user.type "$MNT"/name || fail "user.type"
|
||
|
|
||
|
pack "$MNT" || fail pack
|
||
|
|
||
|
rm -r "$MNT" || fail mount
|