summaryrefslogtreecommitdiffstats
path: root/main/paxmark/paxmark
blob: 562cce78fe1d834e650456480f5d5d2ae2034cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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
flags="${flags//z}"
[ -n "${flags//[!Ee]}" ] || flags="${flags}e"
for f in "$@"; do
	attr -q -s pax.flags -V "${flags}" "${f}" >/dev/null 2>&1 && continue
	ret=1
done

return $ret