meson: restore the SELinux context for our .so file on install
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 20 Jun 2017 23:16:06 +0000 (09:16 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 21 Jun 2017 09:06:46 +0000 (19:06 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
meson.build
src/Makefile.am
src/libinput-restore-selinux-context.sh [new file with mode: 0644]

index 217bf82a5933e1dd46e7e19dd1937eedbb9c02e4..e77f7d13d895ab35af0cc7e483526eb419247b95 100644 (file)
@@ -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')
index 08e6aa1ef4696dbb5c2e9a71720e1d9611f4c2c3..6723d5ae2c0a6ec46c9faf3a541236873f927bb1 100644 (file)
@@ -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 (file)
index 0000000..7fd8fad
--- /dev/null
@@ -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"