Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config wildcard handling script #901

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ xconfd_DATA = conf/xorg.conf.d/10-dummy.conf

CLEANFILES = $(noinst_SCRIPTS) conf/bumblebee.conf $(bin_SCRIPTS)
EXTRA_DIST = scripts/systemd/bumblebeed.service.in \
scripts/bumblebee.bash.in \
scripts/upstart/bumblebeed.conf.in \
conf/99-bumblebee-nvidia-dev.rules \
conf/bumblebee.conf.in \
Expand Down Expand Up @@ -103,10 +104,22 @@ do_subst = sed -e 's|[@]GITVERSION[@]|$(GITVERSION)|g' \
conf/bumblebee.conf: $(srcdir)/conf/bumblebee.conf.in
mkdir -p conf
$(do_subst) < $< > $@

scripts/systemd/bumblebeed.service: $(srcdir)/scripts/systemd/bumblebeed.service.in
if CONF_WILD
scripts/systemd/bumblebeed.service: $(srcdir)/scripts/systemd/bumblebeed_wild.service.in
mkdir -p scripts/systemd
$(do_subst) < $< > $@
sbin_SCRIPTS = scripts/bumblebee.bash
CLEANFILES += $(sbin_SCRIPTS)
else
scripts/systemd/bumblebeed.service: $(srcdir)/scripts/systemd/bumblebeed.service.in
mkdir -p scripts/systemd
$(do_subst) < $< > $@
endif


scripts/bumblebee.bash: $(srcdir)/scripts/bumblebee.bash.in
mkdir -p scripts
$(do_subst) < $< > $@

scripts/bumblebee-bugreport: $(srcdir)/scripts/bumblebee-bugreport.in
mkdir -p scripts
Expand Down
6 changes: 3 additions & 3 deletions conf/xorg.conf.nvidia
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ Section "Device"
Option "ProbeAllGpus" "false"

Option "NoLogo" "true"
Option "UseEDID" "false"
Option "UseDisplayDevice" "none"
# Option "UseEDID" "false"
# Option "UseDisplayDevice" "none"

# If your NVIDIA drivers are version 331.13 or newer, and you have a laptop
# where some of the video outputs such as HDMI or DisplayPort are connected
Expand All @@ -39,5 +39,5 @@ Section "Device"
# below to allow using the external monitor when it is connected while also
# allowing the X server to start when the monitor is disconnected.

# Option "AllowEmptyInitialConfiguration"
Option "AllowEmptyInitialConfiguration"
EndSection
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ AS_IF([test "x$with_pidfile" != xno],
])
AM_CONDITIONAL([WITH_PIDFILE], [test "x$with_pidfile" != xno])


AC_ARG_ENABLE([wild],
[ --enable-wild Turn on wildcard support],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A "wild" daemon is probably not a good idea ;)

Maybe the option and description could be changed to more accurately reflect its functionality?

[case "${enableval}" in
yes) conf_wild=yes ;;
no) conf_wild=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-wild]) ;;
esac],[conf_wild=no])
AM_CONDITIONAL([CONF_WILD], [test "x$conf_wild" != xno])


UDEV_RULES_DIR=/lib/udev/rules.d
AC_ARG_WITH([udev-rules],
[AS_HELP_STRING([--with-udev-rules@<:@=DIR@:>@],
Expand Down
14 changes: 14 additions & 0 deletions quickinstall.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

autoreconf -fi
./configure CONF_DRIVER=nvidia CONF_DRIVER_MODULE_NVIDIA=nvidia-375 \
CONF_PRIMUS_LD_PATH=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus \
CONF_LDPATH_NVIDIA=/usr/lib/nvidia-375:/usr/lib32/nvidia-375 \
CONF_MODPATH_NVIDIA=/usr/lib/nvidia-375/xorg,/usr/lib/xorg/modules \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is prone to getting outdated. Remove it? Instructions in the README should be clear


make clean
make
sudo make install
sudo cp scripts/systemd/bumblebeed.service /lib/systemd/system/.


14 changes: 14 additions & 0 deletions quickinstall_wild.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

autoreconf -fi
./configure CONF_DRIVER=nvidia CONF_DRIVER_MODULE_NVIDIA=nvidia???? \
CONF_PRIMUS_LD_PATH=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus \
CONF_LDPATH_NVIDIA=/usr/lib/nvidia????:/usr/lib32/nvidia???? \
CONF_MODPATH_NVIDIA=/usr/lib/nvidia????/xorg,/usr/lib/xorg/modules \
--enable-wild
make clean
make
sudo make install
sudo cp scripts/systemd/bumblebeed.service /lib/systemd/system/.


52 changes: 52 additions & 0 deletions scripts/bumblebee.bash.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash


if [ 0 -eq $# ]
then
ConfFile="@BBCONFDIR@/bumblebee.conf"
else
ConfFile=$1
fi


ConfDriver=$( crudini --get $ConfFile bumblebeed driver )
ConfKernelDriver=$( crudini --get $ConfFile driver-nvidia kerneldriver )
ConfLibraryPath=$( crudini --get $ConfFile driver-nvidia librarypath )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crudini is not installed by default.

ConfXorgModulePath=$( crudini --get $ConfFile driver-nvidia xorgmodulepath )

echo "Bumblebee config file: $ConfFile"
echo " Raw config parameters: "
echo " Driver = $ConfDriver"
echo " KernelDriver = $ConfKernelDriver"
echo " LibraryPath = $ConfLibraryPath"
echo " XorgModulePath = $ConfXorgModulePath"

Driver=$ConfDriver

KernelDriver=$(find /lib/modules/$(uname -r) -name $ConfKernelDriver.ko -printf "%f\n" | tail --lines=1 )
KernelDriver=${KernelDriver:0:-3}

LibraryPath=
for i in $(echo "$ConfLibraryPath" | sed "s/:/ /g")
do
LibraryPath=$LibraryPath:$(ls -drt $i | tail --lines=1 )
done
LibraryPath=${LibraryPath:1}

XorgModulePath=
for i in $(echo "$ConfXorgModulePath" | sed "s/,/ /g")
do
XorgModulePath=$XorgModulePath,$(ls -drt $i | tail --lines=1 )
done
XorgModulePath=${XorgModulePath:1}

echo " After applying wildcard:"
echo " Driver = $Driver"
echo " KernelDriver = $KernelDriver"
echo " LibraryPath = $LibraryPath"
echo " XorgModulePath = $XorgModulePath"

bboptions="--driver $Driver --driver-module $KernelDriver --ldpath $LibraryPath --module-path $XorgModulePath"

@SBINDIR@/bumblebeed -C $ConfFile -vvvv --use-syslog $bboptions

12 changes: 12 additions & 0 deletions scripts/systemd/bumblebeed_wild.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Bumblebee C Daemon

[Service]
Type=simple
ExecStartPre=-/usr/bin/prime-select intel
ExecStart=@SBINDIR@/bumblebee.bash @BBCONFDIR@/bumblebee.conf
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target