You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.2 KiB

%global _hardened_build 1
%define otr_user owntracks
%define otr_group owntracks
%define otr_home /var/lib/owntracks/recorder/
Name: owntracks-recorder
Version: 0.8.4
Release: 1%{?dist}
Summary: Store and access data published by OwnTracks apps
Group: System/Location
License: GPLv2
URL: https://owntracks.org/
Source0: https://github.com/owntracks/recorder/archive/%{version}.tar.gz
BuildRequires: mosquitto-devel
BuildRequires: lua-devel
BuildRequires: libsodium-devel
Requires(pre): /usr/sbin/useradd
Requires(pre): /usr/sbin/groupadd
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(post): systemd-units
%description
%prep
%setup -q -n recorder-%{version}
cp config.mk.in config.mk
sed 's|INSTALLDIR = /usr/local|INSTALLDIR = /usr/|' -i config.mk
sed 's|WITH_LUA ?= no|WITH_LUA ?= yes|' -i config.mk
sed 's|WITH_ENCRYPT ?= no|WITH_ENCRYPT ?= yes|' -i config.mk
sed 's|STORAGEDEFAULT = /var/spool/owntracks/recorder/store|STORAGEDEFAULT = /var/lib/owntracks/recorder/store|' -i config.mk
sed 's|DOCROOT = /var/spool/owntracks/recorder/htdocs|DOCROOT = /var/www/owntracks/recorder/|' -i config.mk
sed 's|GHASHPREC = 7|GHASHPREC = 10|' -i config.mk
sed 's|CONFIGFILE = /etc/default/ot-recorder|CONFIGFILE = /etc/owntracks/ot-recorder|' -i config.mk
%build
make %{?_smp_mflags}
%install
%make_install
mkdir -p %{buildroot}%{_unitdir}
cat > %{buildroot}%{_unitdir}/owntracks-recorder.service <<EOF
[Unit]
Description=OwnTracks Recorder
After=network.target
[Service]
Type=simple
User=owntracks
ExecStart=/usr/sbin/ot-recorder
[Install]
WantedBy=multi-user.target
EOF
%pre
getent group %{otr_group} > /dev/null || groupadd -r %{otr_group}
getent passwd %{otr_user} > /dev/null || \
useradd -r -d %{otr_home} -g %{otr_group} \
-s /bin/bash -c "Owntracks user" %{otr_user}
exit 0
%post
%systemd_post owntracks-recorder.service
%preun
%systemd_preun owntracks-recorder.service
%postun
%systemd_postun
%files
%config(noreplace) %{_sysconfdir}/owntracks/ot-recorder
%{_bindir}/ocat
%{_sbindir}/ot-recorder
%{_unitdir}/owntracks-recorder.service
/var/www/owntracks/recorder/
%attr(750,%{otr_user},%{otr_group}) %dir %{otr_home}
%changelog