Skip to content

Commit

Permalink
Gentoo: Support use expand variables for simultaneous xiwi and xorg.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Jezak committed Mar 24, 2017
1 parent 40a0601 commit 058aacf
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
22 changes: 20 additions & 2 deletions installer/gentoo/prepare
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

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
Expand Down Expand Up @@ -88,6 +88,24 @@ By installing $3, the license $2 has been enabled.
"
}

# Set a use expand flag
# Usage: set_use_expand <variable to expand> <flag to enable>
set_use_expand() {
# Check if the variable is already present
EXPAND=`grep "$1" /etc/portage/make.conf | cut -f2 -d\"`
# If not, add it with the desired flag
if [ -z "$EXPAND" ]; then
echo "$1=\"$2\"" >> /etc/portage/make.conf
# If the variable is already present, check if the flag is already set
else
FLAG_SET=`echo $EXPAND | grep $2 | cut -f1 -d\"`
# Add the flag
if [ -z "$FLAG_SET" ]; then
sed -i -e "s|$1=\"\(.*\)\"|$1=\"\1 $2\"|" /etc/portage/make.conf
fi
fi
}

# install_dist: see install() in prepare.sh for details.
install_dist() {
local pkgs=''
Expand Down
17 changes: 10 additions & 7 deletions targets/xiwi
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ if [ "${DISTROAKA:-"$DISTRO"}" = 'debian' ]; then
fi

if [ "${DISTROAKA:-"$DISTRO"}" = 'gentoo' ]; then
VIDEO_CARDS=`grep VIDEO_CARDS /etc/portage/make.conf | cut -d= -f1`
if [ -z ${VIDEO_CARDS} ]; then
echo "VIDEO_CARDS=\"dummy\"" >> /etc/portage/make.conf
echo "INPUT_DEVICES=\"keyboard libinput mouse evdev\"" >> /etc/portage/make.conf
fi
# Set video card and input devices
set_use_expand VIDEO_CARDS dummy
set_use_expand INPUT_DEVICES keyboard
set_use_expand INPUT_DEVICES libinput
set_use_expand INPUT_DEVICES mouse
set_use_expand INPUT_DEVICES evdev

# Set use flags for X
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

set_flags X dbus
# Install xorg
install xorg-x11 xorg-server
# Set the flags for i3 and install it
set_flags xcb xkb
install i3
else
Expand Down
23 changes: 11 additions & 12 deletions targets/xorg
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@ 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
VIDEO_CARDS=`grep VIDEO_CARDS /etc/portage/make.conf | cut -d= -f1`
if [ -z ${VIDEO_CARDS} ]; then
echo "VIDEO_CARDS=\"intel fbdev vesa dummy\"" >> /etc/portage/make.conf
echo "INPUT_DEVICES=\"keyboard libinput mouse evdev\"" >> /etc/portage/make.conf
fi
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 card and input devices
# FIXME: ARM, non-intel?
set_use_expand VIDEO_CARDS intel
set_use_expand INPUT_DEVICES keyboard
set_use_expand INPUT_DEVICES libinput
set_use_expand INPUT_DEVICES mouse
set_use_expand INPUT_DEVICES evdev
set_use_expand INPUT_DEVICES synaptics
fi

# Figure out what we need on this system
Expand Down

0 comments on commit 058aacf

Please sign in to comment.