[PATCH libinput] meson: restore the SELinux context for our .so file on install

Peter Hutterer peter.hutterer at who-t.net
Tue Jun 20 23:43:10 UTC 2017


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
A temporary workaround until the meson bit is fixed.

 meson.build                             |  6 ++++++
 src/Makefile.am                         |  2 +-
 src/libinput-restore-selinux-context.sh | 10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 src/libinput-restore-selinux-context.sh

diff --git a/meson.build b/meson.build
index 217bf82a..e77f7d13 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 08e6aa1e..6723d5ae 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 00000000..7fd8fad0
--- /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"
-- 
2.13.0



More information about the wayland-devel mailing list