Skip to content

Commit

Permalink
Gentoo: Remove the suid bit to allow LD_PRELOAD for libcroutonfreon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Jezak committed Mar 23, 2017
1 parent fc3d141 commit d9808c9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
27 changes: 25 additions & 2 deletions installer/gentoo/prepare
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,41 @@

DISTROAKA='gentoo'

# Set use flags, separated by a space
# Set global use flags, separated by a space
set_flags() {
while [ "$#" != 0 ]; do
local flag=`euse -a $1 | cut -d\[ -f1`;
# If don't already have the flag
if [ -z ${flag} ]; then
if [ -z "${flag}" ]; then
euse -E $1 1> /dev/null
fi
shift
done
}

# Set a package specific use flag
# Usage: set_package_flag <package> <use flag> <crouton target for comment>
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.keywords/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 <package> <crouton target for comment>
keyword_package() {
Expand Down
3 changes: 3 additions & 0 deletions targets/xiwi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ if [ "${DISTROAKA:-"$DISTRO"}" = 'gentoo' ]; then
fi

set_flags X dbus
# We remove the suid bit because it breaks LD_PRELOAD'ing libcroutonfreon.so
set_package_flag x11-base/xorg-server -suid xorg

install xorg-x11 xorg-server
set_flags xcb xkb
install i3
Expand Down
4 changes: 3 additions & 1 deletion targets/xorg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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
set_flags libkms uxa dri3 xvmc opengl -suid
# 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
Expand Down

0 comments on commit d9808c9

Please sign in to comment.