From 3d1574055c025ee049c643d601aad977ca5da36e Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Tue, 19 Mar 2024 10:53:34 -0700 Subject: [PATCH] add xattr test --- func/core/pkg_acl/11-test-acl-xattr.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 func/core/pkg_acl/11-test-acl-xattr.sh diff --git a/func/core/pkg_acl/11-test-acl-xattr.sh b/func/core/pkg_acl/11-test-acl-xattr.sh new file mode 100755 index 0000000..266473a --- /dev/null +++ b/func/core/pkg_acl/11-test-acl-xattr.sh @@ -0,0 +1,22 @@ +#!/bin/bash +ACLIMG=/tmp/testacl.img +r_log "acl" "Test the use of xattr" +touch "${ACLIMG}" +trap '/bin/rm -f ${ACLIMG}' EXIT + +# Use setfacl for readonly +r_log "acl" "Create image" +dd if=/dev/zero of=${ACLIMG} bs=1024000 count=100 +echo -e 'y\n' | mkfs.ext3 "${ACLIMG}" +mkdir /mnt/xattr +mount -t ext3 -o loop,user_xattr "${ACLIMG}" /mnt/xattr +touch /mnt/xattr/testfile + +r_log "acl" "Apply attrs as needed" +setfattr -n user.nobody /mnt/xattr/testfile +getfattr /mnt/xattr/testfile | grep -q 'user.nobody' +final_status=$? + +umount /mnt/xattr + +r_checkExitStatus $final_status