# The following tag is to get correct syntax highlighting for this file in vim text editor
# vim: syntax=spec

Name:       system76-io-dkms
Version:    0.2
Release:    1%{?dist}
Summary:    system76-io-dkms 
License:    GPLv3
URL:        https://github.com/pop-os/system76-io-dkms

# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS:        git+https://github.com/szydell/system76-io-dkms#563d87a480a5fe3f6ad11d907aa2646d65ecce4e:

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source:     system76-io-dkms-0.2.tar.gz

#Packages required for build
#BuildRequires: dbus-devel

#Packages required to work
Requires: dkms
Requires: kernel-devel

# More detailed description of the package
%description
System76 IO DKMS (Dynamic Kernel Module Support)
-----
 DKMS driver for controlling System76 IO Board.
 The module is rebuilt through the DKMS system when a new kernel or module
 become available.
 
%define debug_package %{nil}

#--
%prep
%setup -q -n system76-io-dkms-0.2

%install
install -D -m 0644 *.c -t "%{buildroot}%{_usrsrc}/system76-io-0.2/"
install -m 0644 Makefile -t "%{buildroot}%{_usrsrc}/system76-io-0.2/"
install -m 0644 debian/system76-io-dkms.dkms "%{buildroot}%{_usrsrc}/system76-io-0.2/dkms.conf"

# do after installation
%post
sed -i 's/PACKAGE_VERSION="#MODULE_VERSION#"/PACKAGE_VERSION="0.2"/g' %{_usrsrc}/system76-io-0.2/dkms.conf

/usr/bin/env dkms add -m system76-io -v 0.2 --rpm_safe_upgrade
/usr/bin/env dkms build -m system76-io -v 0.2
/usr/bin/env dkms install -m system76-io -v 0.2 --force

# do before uninstallation
%preun
/usr/bin/env rmmod system76-io || : 
/usr/bin/env dkms remove -m system76-io -v 0.2 --all --rpm_safe_upgrade || :

# do after uninstallation, bugfix
%postun
rm -rfv /var/lib/dkms/system76-io/0.2

# Those files will be in the rpm
%files
%{_usrsrc}/system76-io-0.2

# Changelog
%changelog
* Sun Feb 23 2020 Marcin Szydelski <marcin@szydelscy.pl> 0.2-1
just a tag bump

* Tue Dec 03 2019 Marcin Szydelski <marcin@szydelscy.pl> 0.1-1
- rpm spec init
- Update changelog
- Add mutexes
- Increase buffer size to 32
- Return length of received revision
- Add support for reading revision
- Remove third fan
- 1.0.0
- Update name to bootloader
- Add bootloader support
- Add boot command
- Add retry
- Add suspend command support
- Add license
- Create README.md
- Update PID and VID
- Fix conversion to Io fan units
- Complete implementation of current control items
- Fix interface
- Remove dead code
- Major refactor and implementation of USB protocol
- Only match first interface
- Fix issues with registering hwmon device
- Use interface device for hwmon
- Add hwmon stubs
- init