toolkit/func/core/pkg_attr/10-check-attr.sh
2023-11-16 13:59:52 -07:00

19 lines
567 B
Bash
Executable File

#!/bin/bash
ATTRTEST="/var/tmp/attrtest.img"
ATTRMNT="/mnt/attrtest"
trap 'umount /mnt/attrtest ; /bin/rm -f ${ATTRTEST} ; /bin/rm -rf ${ATTRMNT}' EXIT
r_log "attr" "Checking that *attr works"
dd if=/dev/zero of="${ATTRTEST}" bs=1024000 count=100 &>/dev/null
r_checkExitStatus $?
mkdir "${ATTRMNT}"
echo -e 'y\n' | mkfs.ext3 "${ATTRTEST}" > /dev/null 2>&1
mount -t ext3 -o loop,user_xattr "${ATTRTEST}" "${ATTRMNT}"
touch "${ATTRMNT}/testfile"
setfattr -n user.test "${ATTRMNT}/testfile"
getfattr "${ATTRMNT}/testfile" | grep -oq "user.test"
r_checkExitStatus $?