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>
This commit is contained in:
Peter Hutterer 2017-06-21 09:16:06 +10:00
parent 2ee95c7b76
commit dd25e1799f
3 changed files with 17 additions and 1 deletions

View 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')

View 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

View file

@ -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"