This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 24th, 2012  |  syntax: None  |  size: 3.39 KB  |  views: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. %define bbswitch_ver 0.4.1
  2. Summary: bbswitch Linux kernel module for Bumblebee
  3. Name: bbswitch
  4. Version: %{bbswitch_ver}
  5. Release: 1%{?dist}
  6. License: GNU GPLv3
  7. Group: System Environment/Base
  8. Source0: bbswitch.tar.bz2
  9. # To re-create the source tarball, run the following command:
  10. # git clone git://github.com/Bumblebee-Project/bbswitch.git
  11. # Then tar/bzip the resulting directory up creating bbswitch.tar.bz2.
  12. BuildRoot: %{_tmppath}/%{name}-root
  13. %ifarch i686
  14. %if 0%{?fedora} >=15
  15. Requires: kernel-PAE-devel
  16. %endif
  17. %endif
  18. Requires: dkms gcc kernel-devel
  19.  
  20. %description
  21. bbswitch is a Linux kernel module which automatically detects the required
  22. ACPI calls for two kinds of Optimus laptops. It has been verified to work
  23. with "real" Optimus and "legacy" Optimus laptops.
  24.  
  25. See: https://github.com/Bumblebee-Project/bbswitch/
  26.  
  27. For further information.
  28.  
  29. For now, if you require nvidia module support with bumblebee you must
  30. install bbswitch. In addition, even with nouveau, bbswitch will work
  31. after a suspend whereas vga_switcharoo in the kernel might not. See:
  32. https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods
  33. for further information.
  34.  
  35. %prep
  36.  
  37. %setup -n bbswitch
  38.  
  39. #Next, create the auto-loading module file now so we can install it later...
  40.  
  41. %if 0%{?fedora} >=15
  42. %{__cat} <<EOF >bbswitch.modules
  43. #!/bin/sh
  44.  
  45. if [ ! -f /proc/acpi/bbswitch ] ; then
  46.         exec /sbin/modprobe bbwsitch >/dev/null 2>&1      
  47. fi
  48. EOF
  49. %else
  50. %{__cat} <<EOF >bbswitch.modules
  51. #!/bin/sh
  52. echo -n "Loading bbswitch module..."
  53. if /sbin/modprobe bbswitch
  54. then
  55.         echo "SUCCESS"
  56. else
  57.         echo "FAILURE"
  58. fi
  59. EOF
  60. %endif
  61.  
  62. %build
  63.  
  64. %install
  65. [ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
  66.  
  67. # Its easier to do the work of building this here...
  68.  
  69. mkdir -p $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}
  70. install -m 644 $RPM_BUILD_DIR/bbswitch/bbswitch.c $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/bbswitch.c
  71. install -m 644 $RPM_BUILD_DIR/bbswitch/Makefile $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/Makefile
  72. install -m 644 $RPM_BUILD_DIR/bbswitch/dkms/dkms.conf $RPM_BUILD_ROOT/usr/src/bbswitch-%{bbswitch_ver}/dkms.conf
  73.  
  74. # For the next section below, I needed a way to load the module at boot time. For more information see:
  75. # http://docs.fedoraproject.org/en-US/Fedora/15/html/Deployment_Guide/sec-Persistent_Module_Loading.html
  76.  
  77. mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/modules/
  78. install -m 755 $RPM_BUILD_DIR/bbswitch/bbswitch.modules $RPM_BUILD_ROOT/etc/sysconfig/modules/bbswitch.modules
  79.  
  80. %clean
  81. [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
  82.  
  83.  
  84. %post
  85. /usr/sbin/dkms add -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
  86. /usr/sbin/dkms build -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
  87. /usr/sbin/dkms install -m bbswitch -v %{bbswitch_ver} >/dev/null 2>&1 || :
  88. /sbin/modprobe bbswitch >/dev/null 2>&1 || :
  89.  
  90.  
  91. %preun
  92. /sbin/rmmod bbswitch >/dev/null 2>&1 || :
  93. /usr/sbin/dkms remove -m bbswitch -v %{bbswitch_ver} --all >/dev/null 2>&1 || :
  94.  
  95.  
  96. %files
  97. %defattr(-,root,root,-)
  98. %doc README.md NEWS
  99. /usr/src/bbswitch-%{bbswitch_ver}/bbswitch.c
  100. /usr/src/bbswitch-%{bbswitch_ver}/Makefile
  101. /usr/src/bbswitch-%{bbswitch_ver}/dkms.conf
  102. /etc/sysconfig/modules/bbswitch.modules
  103.  
  104.  
  105. %changelog
  106. * Sat Apr 28 2012 Gary Gatling <gsgatlin@ncsu.edu> - 0.4.1-1
  107. - Initial build of a dkms based bbswitch rpm suitable (?) for a newish
  108.   fedora or RHEL 6.
clone this paste RAW Paste Data