Commit 14a9504d authored by Timo Teräs's avatar Timo Teräs

main/paxmark: validate and sort xattr flags

pax allows each letter to be in the xattr value only once, so
create the value accordingly. This also keeps the letters sorted
in the xattr value which is useful for apk in various ways.
parent 591de303
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=paxmark
pkgver=0.5
pkgver=0.6
pkgrel=0
pkgdesc="Manage PaX marking of executables"
url="http://alpinelinux.org"
......@@ -22,6 +22,6 @@ package() {
ln -s paxmark "$pkgdir"/usr/sbin/paxmark.sh || return 1
}
md5sums="08027e79219ed9b6d0e851e70dfa5f87 paxmark"
sha256sums="be68fcf5ac7a84586e9201f0cca977d8cd4f824058f94b5b89e55f8c3f97711c paxmark"
sha512sums="346119a2cc675eb55440057a83fa9aba7a88bfd5bcc851b7ece34f60fbf5836e984f12af30894da3c795a02639ba189f730d403ef669457048c9777e0b2aaeca paxmark"
md5sums="363ee24e0f8eba76033e27d8ddca4e57 paxmark"
sha256sums="1a2c0275f908d5011d4227dcc04eb32c53c63f2a6ce98f6fae0376e4c5e86c83 paxmark"
sha512sums="eaa0a5cc11d3101df075a5291b14fa4865d959ce580f45e2b898be99397d6956aa1e34809a115d1a8ff7b7cc18abdc29cdf2ed36fdbd01c94500a05d248a5291 paxmark"
......@@ -14,10 +14,21 @@ for f in "$@"; do
done
# Create XATTR_PAX marking using attr
flags="${flags//z}"
[ -n "${flags//[!Ee]}" ] || flags="${flags}e"
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//[!Ee]}" ] && 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 "${flags}" "${f}" >/dev/null 2>&1 && continue
attr -q -s pax.flags -V "${xval}" "${f}" >/dev/null 2>&1 && continue
ret=1
done
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment