updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / catalyst-daemon / autofglrx.sh
blobd97f9a12643ee29ccf55ee48438082c1dcec9166
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
8 LOG="/var/log/catalyst-install.log"
10 kernel=$(uname -r)
13 build_fglrx() {
14 rmmod fglrx >/dev/null 2>&1
15 /usr/bin/catalyst_build_module "${kernel}" >/dev/null 2>&1
16 /usr/bin/catalyst_build_module remove &>> $LOG
19 if [ $? -ne 0 ]
20 then
21 stat_append "ERROR: see ${LOG} for details"
22 stat_die
27 check_fglrx() {
28 compare=$(uname -v)
30 if [[ -e /lib/modules/${kernel}/video/fglrx.ko ]] || [[ -e /lib/modules/${kernel}/extramodules/fglrx.ko ]]
31 then
32 test=$(modinfo -F description fglrx | grep "__unv:") || stat_die
33 else
34 return 0
37 if [ "$test" != "__unv:$compare" ]
38 then
39 return 0
40 else
41 return 1
46 load_fglrx() {
47 stat_append ": Loading fglrx"
48 modprobe fglrx
50 if [ $? -ne 0 ]
51 then
52 stat_die
53 else
54 stat_done
60 case "$1" in
61 start)
62 stat_busy "Checking fglrx"
65 check_fglrx
67 if [ $? -eq 0 ]
68 then
69 stat_append ": Building fglrx "
70 build_fglrx
74 load_fglrx
77 stop)
78 stat_busy "Unloading fglrx"
81 rmmod fglrx
83 if [ $? -ne 0 ]
84 then
85 stat_fail
86 else
87 stat_done
91 restart)
92 $0 stop
93 sleep 1
94 $0 start
97 status)
98 if [ -n "$(lsmod | grep fglrx)" ]
99 then
100 stat_busy "Module fglrx is loaded"
101 stat_done
102 else
103 stat_busy "Module fglrx is not loaded"
104 stat_fail
109 echo "Usage: $0 {start|stop|restart|status}"
110 esac