#!/bin/sh local ret=0 local flags="${1//[!zPpEeMmRrSs]}" [ -n "${flags}" ] || return 0 shift # Create PT_PAX marking (remove after migration) for f in "$@"; do paxctl -q${flags} "${f}" >/dev/null 2>&1 && continue paxctl -qC${flags} "${f}" >/dev/null 2>&1 && continue paxctl -qc${flags} "${f}" >/dev/null 2>&1 && continue ret=1 done # Create XATTR_PAX marking using attr local xval="" [ "${flags//[!P]}" ] && xval="${xval}P" [ "${flags//[!p]}" -a -z "${flags//[!P]}" ] && xval="${xval}p" [ "${flags//[!E]}" ] && xval="${xval}E" [ "${flags//[!e]}" -a -z "${flags//[!E]}" ] && xval="${xval}e" [ -z "${flags//[!zEe]}" ] && xval="${xval}e" [ "${flags//[!M]}" ] && xval="${xval}M" [ "${flags//[!m]}" -a -z "${flags//[!M]}" ] && xval="${xval}m" [ "${flags//[!R]}" ] && xval="${xval}R" [ "${flags//[!r]}" -a -z "${flags//[!R]}" ] && xval="${xval}r" [ "${flags//[!S]}" ] && xval="${xval}S" [ "${flags//[!s]}" -a -z "${flags//[!S]}" ] && xval="${xval}s" for f in "$@"; do attr -q -s pax.flags -V "${xval}" "${f}" >/dev/null && continue ret=1 done return $ret