File dkms-acpi_call.spec of Package dkms-acpi_call
#
# spec file for package dkms-acpi_call
#
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via bumblebee.obs@gmail.com
#
# norootforbuild
#
%define modname acpi_call
Name: dkms-%{modname}
Summary: Kernel module to call ACPI methods
Version: 1.1.0
Release: 0.1
Url: https://github.com/mkottman/acpi_call
Group: System/Kernel
License: GPL-3.0+
Vendor: The Bumblebee Project
Source0: %{modname}-%{version}.tar.bz2
Source1: %{name}-rpmlintrc
Patch1: fixacpi.patch
%if 0%{?suse_version}
Conflicts: acpi_call-kmp-default
Conflicts: acpi_call-kmp-desktop
Conflicts: acpi_call-kmp-pae
Conflicts: acpi_call-kmp-xen
Conflicts: acpi_call-kmp
%endif
Requires: binutils gcc make
%if 0%{?mdkversion}
Requires: dkms-minimal
%else
Requires: dkms
%endif
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
A kernel module that enables you to call ACPI methods by writing the method
name followed by arguments to /proc/acpi/call, for example to turn off discrete
graphics card in a dual graphics environment (like NVIDIA Optimus). This
version is intended for setting battery of ThinkPad notebook.
tpacpi-bat supports ThinkPad T420(s)/T520/W520/X220 and newer models only.
%prep
%setup -q -n %{modname}-%{version}
%patch1 -p1
%build
%install
rm -rf %{buildroot}
#
mkdir -p %{buildroot}/usr/share/doc/packages/%{name}
mv README.md %{buildroot}/usr/share/doc/packages/%{name}
mv examples %{buildroot}/usr/share/doc/packages/%{name}
# install dkms sources
mkdir -p %{buildroot}/usr/src/%{modname}-%{version}-%{release}
cp -R * %{buildroot}/usr/src/%{modname}-%{version}-%{release}/
cat > %{buildroot}/usr/src/%{modname}-%{version}-%{release}/dkms.conf << EOF
PACKAGE_NAME=%{modname}
PACKAGE_VERSION=%{version}-%{release}
MAKE[0]="make -C \${kernel_source_dir} SUBDIRS=\${dkms_tree}/\${PACKAGE_NAME}/\${PACKAGE_VERSION}/build modules"
DEST_MODULE_LOCATION[0]="/updates/"
BUILT_MODULE_NAME[0]=%{modname}
AUTOINSTALL="yes"
EOF
%posttrans
set -x
if [ -x /usr/sbin/dkms ] ; then
/usr/sbin/dkms add -m %{modname} -v %{version}-%{release} --rpm_safe_upgrade
/usr/sbin/dkms build -m %{modname} -v %{version}-%{release}
/usr/sbin/dkms install -m %{modname} -v %{version}-%{release}
fi
%preun
# rmmod can fail
if [ -x /sbin/rmmod ] ; then
/sbin/rmmod %{modname} >/dev/null 2>&1
fi
set -x
if [ -x /usr/sbin/dkms ] ; then
/usr/sbin/dkms remove -m %{modname} -v %{version}-%{release} --all --rpm_safe_upgrade || :
fi
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%dir /usr/src/%{modname}-%{version}-%{release}
/usr/share/doc/packages/%{name}
/usr/src/%{modname}-%{version}-%{release}/*
%changelog