updated on Mon Jan 16 16:00:41 UTC 2012
[aur-mirror.git] / bumblebee-develop-git / bumblebee.install
blob9ecc4f70b778effa465244400dfa7e6b16a75e03
2 _replace_busid() {
3     NVIDIABUSID=$(lspci -d 10de: -n | grep '030[02]:' | cut -d' ' -f1 | tr . :)
5     case $(wc -l <<<"$NVIDIABUSID") in
6       0)
7         echo "The BusID of the nVidia card can't be determined."
8         ;;
9       1)
10         NVIDIABUSID="PCI:$NVIDIABUSID"
11         echo "Detected Bus ID: $NVIDIABUSID"
12         ;;
13       *)
14         # You'll never know.
15         echo "Multiple graphics cards are not supported by Bumblebee yet. The"
16         echo "following PCI Bus IDs have been detected:"
17         echo "$NVIDIABUSID"
18         echo "If this information is wrong, please report it to:"
19         echo "https://github.com/Bumblebee-Project/Bumblebee/issues"
20         # empty the ID so we can detect this as error
21         NVIDIABUSID=
22         ;;
23     esac
25     re_busid='^( *BusID +")[^"]*'
27     for driver in nvidia; do
28         sed -E -i "$1" \
29         -e "s,${re_busid},\1${NVIDIABUSID},"
30     done
33 _backup() {
34     cp "$1" "$1.pacsave"
35     echo "File $1 backed up as $1.pacsave"
38 pre_upgrade() {
39     #rc.d stop bumblebee
40     # Backup old config files if they exist
41     if [ ! -f /etc/bumblebee/xorg.conf.nvidia ]; then
42         _backup /etc/bumblebee/xorg.conf.nvidia
43     fi
44     if [ ! -f /etc/bumblebee/bumblebee.conf ]; then
45         _backup /etc/bumblebee/bumblebee.conf
46     fi
49 post_upgrade() {
50     _replace_busid /etc/bumblebee/xorg.conf.nvidia
51     echo
52     echo "Update complete. The configuration files had been changed to their"
53     echo "default settings. You may need to restore them manually"
54     #rc.d start bumblebee
57 post_install() {
58     _replace_busid /etc/bumblebee/xorg.conf.nvidia
59     id -g bumblebee && echo "Bumblebee group existent" || \
60     groupadd bumblebee && echo "Bumblebee group created"
61     echo "Installation complete..."
62     echo
63     echo "You must add yourself to 'bumblebee' group to run programs"
64     echo "Run your programs with: optirun <name of program>"
65     echo "Visit ArchWiki page on Bumblebee for documentation on how to finish setup,"
66     echo "configure and run applications with Bumblebee:"
67     echo "http://wiki.archlinux.org/index.php/Bumblebee"