summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2017-06-21 09:16:06 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2017-06-21 19:06:46 +1000
commitdd25e1799f58179de3c611e42edfe6087b814d7e (patch)
tree7f5f8e7ebb764d4666c4c61e4955e4e9e26fd798
parent2ee95c7b76bdc004b8b84520c00ac14db4a17bfc (diff)
meson: restore the SELinux context for our .so file on install
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
-rw-r--r--meson.build6
-rw-r--r--src/Makefile.am2
-rw-r--r--src/libinput-restore-selinux-context.sh10
3 files changed, 17 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 217bf82..e77f7d1 100644
--- a/meson.build
+++ b/meson.build
@@ -220,6 +220,12 @@ pkgconfig.generate(
libraries: lib_libinput
)
+# Restore the SELinux context for the libinput.so.a.b.c on install
+# meson bug https://github.com/mesonbuild/meson/issues/1967
+meson.add_install_script('src/libinput-restore-selinux-context.sh',
+ get_option('libdir'),
+ lib_libinput.full_path())
+
############ documentation ############
if get_option('documentation')
diff --git a/src/Makefile.am b/src/Makefile.am
index 08e6aa1..6723d5a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,4 +77,4 @@ pkgconfig_DATA = libinput.pc
AM_CFLAGS = $(GCC_CFLAGS)
DISTCLEANFILES = libinput-version.h
-EXTRA_DIST = libinput-version.h.in libinput.sym
+EXTRA_DIST = libinput-version.h.in libinput.sym libinput-restore-selinux-context.sh
diff --git a/src/libinput-restore-selinux-context.sh b/src/libinput-restore-selinux-context.sh
new file mode 100644
index 0000000..7fd8fad
--- /dev/null
+++ b/src/libinput-restore-selinux-context.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+# $1: abs path to libdir
+# $2: abs path to .so file
+
+libdir="$1"
+sofile=$(basename "$2")
+
+echo "Restoring SELinux context on $MESON_INSTALL_DESTDIR_PREFIX/$libdir/$sofile"
+restorecon "$MESON_INSTALL_DESTDIR_PREFIX/$libdir/$sofile"