public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/lprint] f43: Added more default options
@ 2026-09-04 9:11 Zdenek Dohnal
0 siblings, 0 replies; only message in thread
From: Zdenek Dohnal @ 2026-09-04 9:11 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/lprint
Branch : f43
Commit : 85dfa67834043e62032e6d8054c98debbaf789f0
Author : Zdenek Dohnal <zdohnal@redhat.com>
Date : 2026-09-04T10:17:33+02:00
Stats : +101/-3 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/lprint/c/85dfa67834043e62032e6d8054c98debbaf789f0?branch=f43
Log:
Added more default options
---
diff --git a/lprint.conf b/lprint.conf
index cd22de9..9b60902 100644
--- a/lprint.conf
+++ b/lprint.conf
@@ -13,3 +13,12 @@ server-port=8000
# default log level - info, available levels: fatal, error, warn, info, debug
log-level=info
+
+# use PAM for cups
+auth-service=cups
+
+# set auth group for root to authenticate when adding printer
+auth-group=root
+
+# listen only on localhost
+listen-hostname=localhost
diff --git a/lprint.spec b/lprint.spec
index 52fa0ba..b5e784f 100644
--- a/lprint.spec
+++ b/lprint.spec
@@ -3,7 +3,7 @@
Name: lprint
Version: 1.3.1
-Release: 13%{?dist}
+Release: 14%{?dist}
Summary: A Label Printer Application
License: Apache-2.0
@@ -37,8 +37,9 @@ BuildRequires: systemd-rpm-macros
# lprint server can run as a systemd service, but to don't require systemd by default,
# require filesystem (provides /usr/lib/systemd/system too)
Requires: filesystem
-# uses password-auth PAM module from authselect
-Requires: authselect-libs
+# uses CUPS PAM module - later we can make new module if don't wanna depend on cups
+# - which we want atm to print via cups
+Requires: cups
# requires in the systemd unit
Requires: avahi
@@ -71,6 +72,76 @@ export CC=%{__cc}
install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/lprint.conf
+mkdir -p %{buildroot}%{_libexecdir}/%{name}
+
+cat > %{buildroot}%{_libexecdir}/%{name}/posttrans.sh << 'SCRIPT'
+#!/usr/bin/bash
+
+# upgrade script for adding new options into existing lprint.conf
+# runs once on upgrade via lprint-conf-upgrade.service
+
+conf=/etc/lprint.conf
+
+if test ! -f "$conf"
+then
+ exit 0
+fi
+
+# add auth-service if missing
+if ! grep -q "^auth-service=" "$conf"
+then
+ echo "" >> "$conf"
+ echo "# use PAM for cups" >> "$conf"
+ echo "auth-service=cups" >> "$conf"
+fi
+
+# add auth-group if missing
+if ! grep -q "^auth-group=" "$conf"
+then
+ echo "" >> "$conf"
+ echo "# set auth group for root to authenticate when adding printer" >> "$conf"
+ echo "auth-group=root" >> "$conf"
+fi
+
+# add listen-hostname if missing
+if ! grep -q "^listen-hostname=" "$conf"
+then
+ echo "" >> "$conf"
+ echo "# listen only on localhost" >> "$conf"
+ echo "listen-hostname=localhost" >> "$conf"
+fi
+
+# mark as upgraded so lprint-conf-upgrade.service won't run again
+echo "" >> "$conf"
+echo "# added in version 1.3.1-14" >> "$conf"
+
+exit 0
+SCRIPT
+
+mkdir -p %{buildroot}%{_unitdir}
+
+cat > %{buildroot}%{_unitdir}/lprint-conf-upgrade.service << EOF
+[Unit]
+Description=Upgrade lprint.conf with new default options
+ConditionPathExists=%{_sysconfdir}/lprint.conf
+
+[Service]
+Type=oneshot
+ExecCondition=bash -c '! grep -q "^# added in version" %{_sysconfdir}/lprint.conf'
+ExecStart=bash -c %{_libexecdir}/%{name}/posttrans.sh
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+mkdir -p %{buildroot}%{_unitdir}/lprint.service.d
+
+cat > %{buildroot}%{_unitdir}/lprint.service.d/10-conf-upgrade.conf << EOF
+[Unit]
+After=lprint-conf-upgrade.service
+Wants=lprint-conf-upgrade.service
+EOF
+
%pre
# migration scriptlet to take care of incorrect conf locations
@@ -103,17 +174,32 @@ then
fi
%systemd_post lprint.service
+%systemd_post lprint-conf-upgrade.service
%preun
%systemd_preun lprint.service
+%systemd_preun lprint-conf-upgrade.service
%postun
%systemd_postun_with_restart lprint.service
+%systemd_postun lprint-conf-upgrade.service
+
+%posttrans
+%systemd_posttrans_with_reload lprint-conf-upgrade.service
+
+if [ $1 -gt 1 ]
+then
+ systemctl start lprint-conf-upgrade.service || :
+fi
%files
%doc README.md DOCUMENTATION.md CONTRIBUTING.md CHANGES.md
%license LICENSE NOTICE
%config(noreplace) %{_sysconfdir}/lprint.conf
+%dir %{_libexecdir}/%{name}
+%attr(0744,root,root) %{_libexecdir}/%{name}/posttrans.sh
+%{_unitdir}/lprint-conf-upgrade.service
+%{_unitdir}/lprint.service.d/10-conf-upgrade.conf
%{_bindir}/lprint
%{_mandir}/man1/lprint-add.1*
%{_mandir}/man1/lprint-cancel.1*
@@ -136,6 +222,9 @@ fi
%changelog
+* Fri Sep 04 2026 Zdenek Dohnal <zdohnal@redhat.com> - 1.3.1-14
+- Added more default options
+
* Thu Jul 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-04 9:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 9:11 [rpms/lprint] f43: Added more default options Zdenek Dohnal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox