Skip to content

Instantly share code, notes, and snippets.

@Mezzano
Created March 14, 2019 16:15
Show Gist options
  • Save Mezzano/269333e1a3da656337648a4de252af30 to your computer and use it in GitHub Desktop.
Save Mezzano/269333e1a3da656337648a4de252af30 to your computer and use it in GitHub Desktop.
# please build your rpm file using the command "macq-rpmbuild *.spec"
%{!?_version: %define _version 1.5.0 }
%{!?_release: %define _release 0 }
Name: macq-nmead
Version: %{_version}
Release: %{_release}
License: Proprietary
Summary: gps-nmead receiver daemon
Group: Applications/iCar
Vendor: Macq
Requires: macq-base
Provides: macqel-nmead
Obsoletes: macqel-nmead
%if 0%{?suse_version} != 1320 && ! ( 0%{?ubuntu_version} )
BuildRequires: macq-cryptic-devel >= 3.6.6
%endif
Url: ssh://git@dvcs.macqel/icaros/nmead.git
BuildRequires: macq-dev-tools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tgz
%description
Chuck Taylor's nmea server
%prep
%setup -q
%build
MAJOR=$(echo %{_version} | awk -F. '{print $1}')
%if 0%{?suse_version} == 1030
make
%else
mkdir build
cd build
cmake ../src -DVERSION=%{_version} -DSONAME=$MAJOR -DCMAKE_INSTALL_PREFIX=/usr -DLIBDIR=%_libdir
make %{?_smp_mflags} SPEC_VERSION=%{version}
%endif
%if 0%{?suse_version} != 1320 && ! ( 0%{?ubuntu_version} )
macq-sign-binary macq-nmead
%endif
%install
cd build
make install DESTDIR=${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/etc/macq/icar
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/systemd/system
cp ../conf/nmead.sd.xml ${RPM_BUILD_ROOT}/etc/macq/icar
cp ../conf/macq-nmead.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/macq-nmead.service
cp ../src/macq-nmead-init ${RPM_BUILD_ROOT}/usr/bin
%clean
rm -rf $RPM_BUILD_ROOT
%post
usermod -a -G dialout macq
%if 0%{?ubuntu_version}
systemctl daemon-reload
systemctl enable macq-nmead.service
systemctl start macq-nmead.service
%endif
%preun
%if 0%{?ubuntu_version}
if [ $1 == 0 ]; then #uninstall
systemctl unmask macq-nmead.service
systemctl stop macq-nmead.service
systemctl disable macq-nmead.service
fi
%endif
%postun
%if 0%{?ubuntu_version}
if [ $1 == 0 ]; then #uninstall
systemctl daemon-reload
systemctl reset-failed
fi
%endif
%files
%defattr(-,root,root)
/usr/bin/macq-nmead-init
%if 0%{?ubuntu_version}
/usr/lib/systemd/system/macq-nmead.service
%else
/etc/macq/icar/nmead.sd.xml
%endif
%defattr(6755,root,root)
/usr/bin/macq-nmead
%changelog
* Tue Mar 12 2019 Tanguy Mezzano - 1.5.0-0
- use systemd for ubuntu
* Wed Jan 18 2017 Chris Maes - 1.4.2-3
- don't restart super-daemon each time
* Wed Jan 18 2017 Chris Maes - 1.4.2-2
- restart macq-super-daemon after (un)install of rpm
* Wed Dec 09 2015 Benoit Van Bogaert - 1.4.2-1
- Do not sign nmead on OpenSuse 13.2
* Wed Jun 10 2015 Chris Maes - 1.4.2-0
- fix nmead-init script + add macq to secondary dialout group
* Wed Jun 10 2015 Chris Maes - 1.4.1-0
- bugfix macq-nmead-init
* Tue Jun 09 2015 Chris Maes - 1.4.0-0
- start nmead with icar-super-daemon, add script to set correct parameters at startup
* Tue May 19 2015 Chris Maes - 1.3.0-2
- fix build for 64bit
* Mon May 04 2015 Chris Maes - 1.3.0-1
- make sure nmead is signed
* Thu Apr 23 2015 Chris Maes - 1.3.0-0
- create initial rpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment