scripts / primusrun /
6b480ed 2 years ago
1 contributor
34 lines | 1.143kb
#!/bin/bash

# horrible pansement pour permettre à bumblebee de fonctionner
# ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963980

# PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/usr/sbin
# $0 : /usr/local/bin/primusrun

if dpkg -l primus > /dev/null 2>&1; then
    eval "$(egrep '^\s*(export +)?[A-Za-z_]+=' /usr/bin/primusrun)"
# autres variables (cf. /usr/bin/primusrun):
# export PRIMUS_SYNC=${PRIMUS_SYNC:-0}
# export PRIMUS_VERBOSE=${PRIMUS_VERBOSE:-1}
# export PRIMUS_UPLOAD=${PRIMUS_UPLOAD:-0}
# export PRIMUS_SLEEP=${PRIMUS_SLEEP:-90}
# export PRIMUS_DISPLAY=${PRIMUS_DISPLAY:-:8}
# export PRIMUS_libGLa=${PRIMUS_libGLa:-'/usr/$LIB/nvidia/libGL.so.1'}
# export PRIMUS_libGLd=${PRIMUS_libGLd:-'/usr/$LIB/libGL.so.1'}
    (
        path=/proc/driver/nvidia
        if ! test -e $path; then
            IFS=':' read -a radio <<< $(LANG=C nmcli -t radio)
            nmcli radio wifi off
            while ! test -e $path; do
                continue
            done
            test ${radio[1]} = 'enabled' && nmcli radio wifi on
        fi
    )&
    exec "$@"
else
    echo "primus isn't installed"
    exit 1
fi