From 40a06015f851f056cc61a0133cfb8f286b9e8ef6 Mon Sep 17 00:00:00 2001 From: Joseph Jezak Date: Thu, 23 Mar 2017 18:01:43 +0000 Subject: [PATCH] Gentoo: Remove the suid bit to allow LD_PRELOAD for libcroutonfreon. --- installer/gentoo/prepare | 23 +++++++++++++++++++++++ targets/xiwi | 3 +++ targets/xorg | 3 +++ 3 files changed, 29 insertions(+) diff --git a/installer/gentoo/prepare b/installer/gentoo/prepare index fe5aef12b..23ddda26c 100644 --- a/installer/gentoo/prepare +++ b/installer/gentoo/prepare @@ -19,6 +19,29 @@ set_flags() { done } +# Set a package specific use flag +# Usage: set_package_flag +set_package_flag() { + # Check if the directory exists + if [ ! -d /etc/portage/package.use ]; then + mkdir /etc/portage/package.use + fi + + # Check if the package use file exists + if [ ! -f /etc/portage/package.use/crouton ]; then + touch /etc/portage/package.use/crouton + fi + + # Check if the requested package/use is already in the file + USEFLAG=`grep -e "^$1 $2$" /etc/portage/package.use/crouton | cut -f1 -d1` + + # Set the use flag + if [ -z "${USEFLAG}" ]; then + echo "# Added flag $2 to $1 for crouton target $3" >> /etc/portage/package.use/crouton + echo "$1 $2" >> /etc/portage/package.use/crouton + fi +} + # Set unstable keywords for a package # Usage: keyword_package keyword_package() { diff --git a/targets/xiwi b/targets/xiwi index 3b6065999..5a055fe62 100755 --- a/targets/xiwi +++ b/targets/xiwi @@ -35,6 +35,9 @@ if [ "${DISTROAKA:-"$DISTRO"}" = 'gentoo' ]; then echo "INPUT_DEVICES=\"keyboard libinput mouse evdev\"" >> /etc/portage/make.conf fi + # We remove the suid bit because it breaks LD_PRELOAD'ing libcroutonfreon.so + set_package_flag x11-base/xorg-server -suid xorg + set_flags X dbus install xorg-x11 xorg-server set_flags xcb xkb diff --git a/targets/xorg b/targets/xorg index 234327864..2c294f5ca 100644 --- a/targets/xorg +++ b/targets/xorg @@ -18,6 +18,9 @@ rm -f '/etc/crouton/xserverrc-x11' # Set the use flags on gentoo that we'll need for X if [ "${DISTROAKA:-"$DISTRO"}" = 'gentoo' ]; then set_flags libkms uxa dri3 xvmc opengl + + # We remove the suid bit because it breaks LD_PRELOAD'ing libcroutonfreon.so + set_package_flag x11-base/xorg-server -suid xorg # Set VIDEO_CARDS and INPUT_DEVICES # FIXME: Perhaps make this more flexible, right now just pick all of them