diff --git a/installer/gentoo/prepare b/installer/gentoo/prepare index fe5aef12b..5049f4588 100644 --- a/installer/gentoo/prepare +++ b/installer/gentoo/prepare @@ -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 +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 keyword_package() { diff --git a/targets/xiwi b/targets/xiwi index 3b6065999..c2bec7093 100755 --- a/targets/xiwi +++ b/targets/xiwi @@ -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 diff --git a/targets/xorg b/targets/xorg index 234327864..80f25f2a3 100644 --- a/targets/xorg +++ b/targets/xorg @@ -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