diff --git a/lprint.conf b/lprint.conf index 4a3d235..962317e 100644 --- a/lprint.conf +++ b/lprint.conf @@ -1,3 +1,4 @@ +# Default configuration # multi-queue - Support multiple print queues. # web-interface - Web UI. # raw-socket - Provide a raw ("JetDirect") socket for each printer on port 91xx. diff --git a/lprint.spec b/lprint.spec index 8cdc2bc..af7c2d2 100644 --- a/lprint.spec +++ b/lprint.spec @@ -3,7 +3,7 @@ Name: lprint Version: 1.3.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A Label Printer Application License: Apache-2.0 @@ -73,16 +73,35 @@ export CC=%{__cc} install -p -D -m 0644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/lprint.conf %pre +# migration scriptlet to take care of incorrect conf locations if [ $1 -gt 1 ] then + # daemon moved /etc/lprint.conf into /var/lib/lprint.state if the latter was missing and + # no HOME env set - this is incorrect, move it back to /etc (server-options are present only in + # system conf file). It was daemon solution for migration of configuration after fixing the bug + # which gets fixed by next scriptlet (the state was written into /etc) + if test -f /var/lib/lprint.state + then + ! grep -q "^server-options" /var/lib/lprint.state || mv -f /var/lib/lprint.state /etc/lprint.conf + fi + + # the original issue - state was written into /etc instead of /var/lib - check if the /etc/lprint.conf + # is an actual state file, and if it is, move it into right directory if state file does not exist. if test ! -f /var/lib/lprint.state -a -f /etc/lprint.conf then # if the lprint.conf is the default one from RPM, do not move - grep -q "^# Fedora default configuration" /etc/lprint.conf || mv -f /etc/lprint.conf /var/lib/lprint.state + grep -q "^server-options" /etc/lprint.conf || mv -f /etc/lprint.conf /var/lib/lprint.state fi fi %post +# generate an empty state file to prevent /etc config file being moved into +# /var/lib/ +if test ! -f /var/lib/lprint.state +then + touch /var/lib/lprint.state +fi + %systemd_post lprint.service %preun @@ -113,9 +132,13 @@ fi %{_mandir}/man1/lprint.1* %{_mandir}/man5/lprint.conf.5* %{_unitdir}/lprint.service +%ghost %{_sharedstatedir}/lprint.state %changelog +* Mon Nov 18 2024 Zdenek Dohnal - 1.3.1-7 +- RHEL-62834 Fix post scriptlet + * Mon Nov 18 2024 Zdenek Dohnal - 1.3.1-6 - RHEL-67908 lprint requires avahi-daemon.socket, but does not install avahi