aboutsummaryrefslogtreecommitdiffstats
path: root/main/paxmark
diff options
context:
space:
mode:
Diffstat (limited to 'main/paxmark')
-rw-r--r--main/paxmark/APKBUILD27
-rw-r--r--main/paxmark/paxmark25
2 files changed, 52 insertions, 0 deletions
diff --git a/main/paxmark/APKBUILD b/main/paxmark/APKBUILD
new file mode 100644
index 0000000000..4df862bc71
--- /dev/null
+++ b/main/paxmark/APKBUILD
@@ -0,0 +1,27 @@
+# Maintainer: Timo Teräs <timo.teras@iki.fi>
+pkgname=paxmark
+pkgver=0.5
+pkgrel=0
+pkgdesc="Manage PaX marking of executables"
+url="http://alpinelinux.org"
+arch="noarch"
+license="GPL"
+depends="paxctl attr"
+makedepends=""
+install=""
+subpackages=""
+source="paxmark"
+
+build() {
+ return 0
+}
+
+package() {
+ mkdir -p "$pkgdir"/usr/sbin
+ install -m755 "$srcdir"/paxmark "$pkgdir"/usr/sbin || return 1
+ ln -s paxmark "$pkgdir"/usr/sbin/paxmark.sh || return 1
+}
+
+md5sums="08027e79219ed9b6d0e851e70dfa5f87 paxmark"
+sha256sums="be68fcf5ac7a84586e9201f0cca977d8cd4f824058f94b5b89e55f8c3f97711c paxmark"
+sha512sums="346119a2cc675eb55440057a83fa9aba7a88bfd5bcc851b7ece34f60fbf5836e984f12af30894da3c795a02639ba189f730d403ef669457048c9777e0b2aaeca paxmark"
diff --git a/main/paxmark/paxmark b/main/paxmark/paxmark
new file mode 100644
index 0000000000..562cce78fe
--- /dev/null
+++ b/main/paxmark/paxmark
@@ -0,0 +1,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
+