Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %define bbswitch_ver 0.4.1
- Summary: bbswitch Linux kernel module for Bumblebee
- Name: bbswitch
- Version: %{bbswitch_ver}
- Release: 1%{?dist}
- License: GNU GPLv3
- Group: System Environment/Base
- Source0: bbswitch.tar.bz2
- # To re-create the source tarball, run the following command:
- # git clone git://github.com/Bumblebee-Project/bbswitch.git
- # Then tar/bzip the resulting directory up creating bbswitch.tar.bz2.
- BuildRoot: %{_tmppath}/%{name}-root
- %ifarch i686
- %if 0%{?fedora} >=15
- Requires: kernel-PAE-devel
- %endif
- %endif
- Requires: dkms gcc kernel-devel
- %description
- bbswitch is a Linux kernel module which automatically detects the required
- ACPI calls for two kinds of Optimus laptops. It has been verified to work
- with "real" Optimus and "legacy" Optimus laptops.
- See: https://github.com/Bumblebee-Project/bbswitch/
- For further information.
- For now, if you require nvidia module support with bumblebee you must
- install bbswitch. In addition, even with nouveau, bbswitch will work
- after a suspend whereas vga_switcharoo in the kernel might not. See:
- https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods
- for further information.
- %prep
- %setup -n bbswitch
- #Next, create the auto-loading module file now so we can install it later...
- %if 0%{?fedora} >=15
- %{__cat} <<EOF >bbswitch.modules
- #!/bin/sh
- if [ ! -f /proc/acpi/bbswitch ] ; then
- exec /sbin/modprobe bbwsitch >/dev/null 2>&1
- fi
- EOF
- %else
- %{__cat} <<EOF >bbswitch.modules
- #!/bin/sh
- echo -n "Loading bbswitch module..."
- if /sbin/modprobe bbswitch
- then
- echo "SUCCESS"
- else
- echo "FAILURE"
- fi
- EOF
- %endif
- %build
- %install
- [ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
- # Its easier to do the work of building this here...
- mkdir -p $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}
- install -m 644 $RPM_BUILD_DIR/bbswitch/bbswitch.c $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/bbswitch.c
- install -m 644 $RPM_BUILD_DIR/bbswitch/Makefile $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/Makefile
- install -m 644 $RPM_BUILD_DIR/bbswitch/dkms/dkms.conf $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/dkms.conf
- # For the next section below, I needed a way to load the module at boot time. For more information see:
- # http://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/sec-Persistent_Module_Loading.html
- mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/modules/
- install -m 755 $RPM_BUILD_DIR/bbswitch/bbswitch.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/bbswitch.modules
- %clean
- [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
- %post
- /usr/sbin/dkms add -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
- /usr/sbin/dkms build -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
- /usr/sbin/dkms install -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
- /sbin/modprobe bbswitch >/dev/null 2>&1 || :
- %preun
- /sbin/rmmod bbswitch >/dev/null 2>&1 || :
- /usr/sbin/dkms remove -m bbswitch -v %{bbswitch_ver} --all >/dev/null 2>&1 || :
- %files
- %defattr(-,root,root,-)
- %doc README.md NEWS
- /usr/src/bbswitch-%{bbswitch_ver}/bbswitch.c
- /usr/src/bbswitch-%{bbswitch_ver}/Makefile
- /usr/src/bbswitch-%{bbswitch_ver}/dkms.conf
- /etc/sysconfig/modules/bbswitch.modules
- %changelog
- * Sat Apr 28 2012 Gary Gatling <gsgatlin@ncsu.edu> - 0.4.1-1
- - Initial build of a dkms based bbswitch rpm suitable (?) for a newish
- fedora or RHEL 6.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement