2021-05-22 21:47:19 +00:00
|
|
|
%define __spec_install_post %{nil}
|
|
|
|
%define __os_install_post %{_dbpath}/brp-compress
|
|
|
|
%define debug_package %{nil}
|
|
|
|
|
|
|
|
Name: printerfacts
|
|
|
|
Summary: Printer facts: The API
|
|
|
|
Version: @@VERSION@@
|
|
|
|
Release: @@RELEASE@@%{?dist}
|
|
|
|
License: MIT
|
2021-05-22 22:19:14 +00:00
|
|
|
Group: Network
|
2021-05-22 21:47:19 +00:00
|
|
|
Source0: %{name}-%{version}.tar.gz
|
2021-05-22 22:03:48 +00:00
|
|
|
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
|
|
|
|
Requires(postun): /usr/sbin/userdel
|
2021-05-22 22:24:17 +00:00
|
|
|
BuildRequires: systemd
|
2021-05-22 21:47:19 +00:00
|
|
|
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
|
|
|
|
|
|
|
%description
|
|
|
|
%{summary}
|
|
|
|
|
2021-05-22 22:03:48 +00:00
|
|
|
%pre
|
2021-05-22 22:57:03 +00:00
|
|
|
/usr/bin/getent passwd printerfacts || /usr/sbin/useradd -r -d /var/lib/printerfacts -s /sbin/nologin printerfacts
|
2021-05-22 22:03:48 +00:00
|
|
|
|
|
|
|
#Upgrading
|
|
|
|
if [ $1 -eq 2 ]; then
|
2021-05-22 22:20:47 +00:00
|
|
|
/usr/bin/systemctl stop %{name}.service >/dev/null 2>&1 ||:
|
2021-05-22 22:03:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
%post
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
/usr/bin/systemctl daemon-reload
|
2021-05-22 23:01:15 +00:00
|
|
|
/usr/bin/systemctl enable --now %{name}.service
|
2021-05-22 22:03:48 +00:00
|
|
|
fi
|
|
|
|
if [ $1 -eq 2 ]; then
|
|
|
|
/usr/bin/systemctl daemon-reload
|
2021-05-22 23:01:15 +00:00
|
|
|
/usr/bin/systemctl enable --now %{name}.service
|
2021-05-22 22:03:48 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-22 23:01:15 +00:00
|
|
|
%preu
|
2021-05-22 22:03:48 +00:00
|
|
|
#old package
|
|
|
|
#uninstall
|
|
|
|
if [ $1 -eq 0 ]; then
|
2021-05-22 22:20:47 +00:00
|
|
|
/usr/bin/systemctl --no-reload disable %{name}.service
|
|
|
|
/usr/bin/systemctl stop %{name}.service >/dev/null 2>&1 ||:
|
|
|
|
/usr/bin/systemctl disable %{name}.service
|
2021-05-22 22:03:48 +00:00
|
|
|
|
|
|
|
fi
|
|
|
|
if [ $1 -eq 1 ]; then
|
2021-05-22 22:20:47 +00:00
|
|
|
/usr/bin/systemctl --no-reload disable %{name}.service
|
|
|
|
/usr/bin/systemctl stop %{name}.service
|
2021-05-22 22:03:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
%postun
|
|
|
|
/usr/sbin/userdel printerfacts
|
|
|
|
|
2021-05-22 21:47:19 +00:00
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
|
|
|
|
%install
|
|
|
|
rm -rf %{buildroot}
|
|
|
|
mkdir -p %{buildroot}
|
|
|
|
cp -a * %{buildroot}
|
2021-05-22 22:08:09 +00:00
|
|
|
mkdir -p %{buildroot}%{_unitdir}
|
2021-05-22 21:47:19 +00:00
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf %{buildroot}
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
%{_bindir}/*
|
2021-05-22 22:37:18 +00:00
|
|
|
/etc/default/printerfacts
|
|
|
|
/lib/systemd/system/printerfacts.service
|