/
crazybee.sh
138 lines (110 loc) · 3.35 KB
/
crazybee.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
## run as root
# Ryan P. C. McQuen | Everett, WA
# curl https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh | sh
STABLE=${STABLE:-no}
REINSTALL=${REINSTALL:-no}
UPDATE=${UPDATE:-yes}
if [ ! $UID = 0 ]; then
cat << EOF
This script must be run as root.
EOF
exit 1
fi
if [ -e ~/Bumblebee-SlackBuilds/crazybee.sh ]; then
echo "Reinstall!"
export REINSTALL=${REINSTALL:-yes}
elif [ -d ~/Bumblebee-SlackBuilds/ ]; then
cat << EOF
You already have the bumblebee directory,
please rename to avoid changes you may have made.
EOF
exit 1
fi
if [ "$(uname -m)" = "x86_64" ] && [ -e /lib/libc.so.6 ]; then
export COMPAT32=yes;
fi
install_latest_pkg() {
PACKAGE=$1
if [ -d "$PACKAGE/" ]; then
cd $PACKAGE/
else
cd ../$PACKAGE/
fi
sh $PACKAGE.SlackBuild
ls -t --color=never /tmp/$PACKAGE-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
}
install_latest_pkg_compat() {
PACKAGE=$1
if [ -d "$PACKAGE/" ]; then
cd $PACKAGE/
else
cd ../$PACKAGE/
fi
if [ "$COMPAT32" = yes ]; then
COMPAT32=yes sh $PACKAGE.SlackBuild
else
sh $PACKAGE.SlackBuild
fi
ls -t --color=never /tmp/$PACKAGE-*_bbsb.txz | head -1 | xargs -i upgradepkg --reinstall --install-new {}
}
if [ "$UPDATE" = "yes" -a "$REINSTALL" = "no" ]; then
cd
git clone https://github.com/WhiteWolf1776/Bumblebee-SlackBuilds.git
cd Bumblebee-SlackBuilds/
fi
if [ "$UPDATE" = "yes" -a "$STABLE" = "yes" ]; then
git checkout 14.1
fi
## in case there are updates ;-)
if [ "$UPDATE" = "yes" -a "$REINSTALL" = "yes" ]; then
git pull
fi
## let's get some tarballs!
sh download.sh
groupadd bumblebee
## add all non-root users (except ftp) to bumblebee group
getent passwd | grep "/home" | cut -d: -f1 | sed '/ftp/d' | xargs -i usermod -G bumblebee -a {}
install_latest_pkg libbsd
install_latest_pkg bumblebee
install_latest_pkg bbswitch
install_latest_pkg_compat primus
install_latest_pkg_compat primus_vk
cd ../nouveau-blacklist/
removepkg xf86-video-nouveau-blacklist-noarch-1.txz
ls -t --color=never xf86-video-nouveau-blacklist-*noarch-[0-9]*.txz | \
head -1 | xargs -i upgradepkg --install-new --reinstall {}
if [ -z "$(grep xf86-video-nouveau /etc/slackpkg/blacklist)" ]; then
echo xf86-video-nouveau >> /etc/slackpkg/blacklist
fi
if [ -z "$(grep _bbsb /etc/slackpkg/blacklist)" ]; then
echo "[0-9]+_bbsb" >> /etc/slackpkg/blacklist
fi
if [ "$STABLE" = "yes" ]; then
install_latest_pkg libvdpau
fi
install_latest_pkg nvidia-kernel
install_latest_pkg_compat nvidia-bumblebee
chmod +x /etc/rc.d/rc.bumblebeed
/etc/rc.d/rc.bumblebeed start
if [ -z "$(grep bumblebeed /etc/rc.d/rc.local)" ]; then
echo "if [ -x /etc/rc.d/rc.bumblebeed ]; then
/etc/rc.d/rc.bumblebeed start
fi" >> /etc/rc.d/rc.local
fi
if [ -z "$(grep bumblebeed /etc/rc.d/rc.local_shutdown)" ]; then
echo "if [ -x /etc/rc.d/rc.bumblebeed ]; then
/etc/rc.d/rc.bumblebeed stop
fi" >> /etc/rc.d/rc.local_shutdown
fi
## these have to be executable to work :-)
chmod 755 /etc/rc.d/rc.local
chmod 755 /etc/rc.d/rc.local_shutdown
if [ "$UPDATE" = "yes" ]; then
wget -N https://raw.githubusercontent.com/ryanpcmcquen/linuxTweaks/master/slackware/crazybee.sh -P ~/Bumblebee-SlackBuilds
fi
echo
echo "+===========================================+"
echo "+ Please reboot to enjoy your new driver. +"
echo "+===========================================+"
echo