[cups/f17] Small error handling improvements in the configuration migration script.
Tim Waugh
twaugh at fedoraproject.org
Tue Dec 4 12:32:40 UTC 2012
commit 5cc4614f18f117e1a52b7c123857bab64e346314
Author: Tim Waugh <twaugh at redhat.com>
Date: Tue Dec 4 11:20:58 2012 +0000
Small error handling improvements in the configuration migration script.
cups.spec | 66 +++++++++++++++++++++++++++++++++---------------------------
1 files changed, 36 insertions(+), 30 deletions(-)
---
diff --git a/cups.spec b/cups.spec
index 9804c1e..2cacf91 100644
--- a/cups.spec
+++ b/cups.spec
@@ -12,7 +12,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.5.4
-Release: 15%{?dist}
+Release: 16%{?dist}
License: GPLv2
Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@@ -483,6 +483,32 @@ php --no-php-ini \
%post
+if [ $1 -eq 1 ] ; then
+ # Initial installation
+ /bin/systemctl enable cups.{service,socket,path} >/dev/null 2>&1 || :
+fi
+
+# Remove old-style certs directory; new-style is /var/run
+# (see bug #194581 for why this is necessary).
+/bin/rm -rf %{_sysconfdir}/cups/certs
+%if %use_alternatives
+/usr/sbin/alternatives --install %{_bindir}/lpr print %{_bindir}/lpr.cups 40 \
+ --slave %{_bindir}/lp print-lp %{_bindir}/lp.cups \
+ --slave %{_bindir}/lpq print-lpq %{_bindir}/lpq.cups \
+ --slave %{_bindir}/lprm print-lprm %{_bindir}/lprm.cups \
+ --slave %{_bindir}/lpstat print-lpstat %{_bindir}/lpstat.cups \
+ --slave %{_bindir}/cancel print-cancel %{_bindir}/cancel.cups \
+ --slave %{_sbindir}/lpc print-lpc %{_sbindir}/lpc.cups \
+ --slave %{_mandir}/man1/cancel.1.gz print-cancelman %{_mandir}/man1/cancel-cups.1.gz \
+ --slave %{_mandir}/man1/lp.1.gz print-lpman %{_mandir}/man1/lp-cups.1.gz \
+ --slave %{_mandir}/man8/lpc.8.gz print-lpcman %{_mandir}/man8/lpc-cups.8.gz \
+ --slave %{_mandir}/man1/lpq.1.gz print-lpqman %{_mandir}/man1/lpq-cups.1.gz \
+ --slave %{_mandir}/man1/lpr.1.gz print-lprman %{_mandir}/man1/lpr-cups.1.gz \
+ --slave %{_mandir}/man1/lprm.1.gz print-lprmman %{_mandir}/man1/lprm-cups.1.gz \
+ --slave %{_mandir}/man1/lpstat.1.gz print-lpstatman %{_mandir}/man1/lpstat-cups.1.gz
+%endif
+rm -f %{_localstatedir}/cache/cups/*.ipp %{_localstatedir}/cache/cups/*.cache
+
# Deal with config migration due to CVE-2012-5519 (STR #4223)
IN=%{_sysconfdir}/cups/cupsd.conf
OUT=%{_sysconfdir}/cups/cups-files.conf
@@ -501,49 +527,25 @@ for keyword in AccessLog CacheDir ConfigFilePerm \
"`/bin/grep -i ^$keyword "$OUT"`" ]; then
copy=no
else
- /bin/sed -i -e "s,^$keyword,#$keyword,i" "$OUT"
+ /bin/sed -i -e "s,^$keyword,#$keyword,i" "$OUT" || :
fi
fi
if [ "$copy" == "yes" ]; then
if [ "$copiedany" == "no" ]; then
- cat >> "$OUT" <<EOF
+ ( cat >> "$OUT" <<EOF
# Settings automatically moved from cupsd.conf by RPM package:
EOF
+ ) || :
fi
- /bin/grep -i ^$keyword "$IN" >> "$OUT"
+ ( /bin/grep -i ^$keyword "$IN" >> "$OUT" ) || :
copiedany=yes
fi
- /bin/sed -i -e "s,^$keyword,#$keyword,i" "$IN"
+ /bin/sed -i -e "s,^$keyword,#$keyword,i" "$IN" || :
done
-if [ $1 -eq 1 ] ; then
- # Initial installation
- /bin/systemctl enable cups.{service,socket,path} >/dev/null 2>&1 || :
-fi
-
-# Remove old-style certs directory; new-style is /var/run
-# (see bug #194581 for why this is necessary).
-/bin/rm -rf %{_sysconfdir}/cups/certs
-%if %use_alternatives
-/usr/sbin/alternatives --install %{_bindir}/lpr print %{_bindir}/lpr.cups 40 \
- --slave %{_bindir}/lp print-lp %{_bindir}/lp.cups \
- --slave %{_bindir}/lpq print-lpq %{_bindir}/lpq.cups \
- --slave %{_bindir}/lprm print-lprm %{_bindir}/lprm.cups \
- --slave %{_bindir}/lpstat print-lpstat %{_bindir}/lpstat.cups \
- --slave %{_bindir}/cancel print-cancel %{_bindir}/cancel.cups \
- --slave %{_sbindir}/lpc print-lpc %{_sbindir}/lpc.cups \
- --slave %{_mandir}/man1/cancel.1.gz print-cancelman %{_mandir}/man1/cancel-cups.1.gz \
- --slave %{_mandir}/man1/lp.1.gz print-lpman %{_mandir}/man1/lp-cups.1.gz \
- --slave %{_mandir}/man8/lpc.8.gz print-lpcman %{_mandir}/man8/lpc-cups.8.gz \
- --slave %{_mandir}/man1/lpq.1.gz print-lpqman %{_mandir}/man1/lpq-cups.1.gz \
- --slave %{_mandir}/man1/lpr.1.gz print-lprman %{_mandir}/man1/lpr-cups.1.gz \
- --slave %{_mandir}/man1/lprm.1.gz print-lprmman %{_mandir}/man1/lprm-cups.1.gz \
- --slave %{_mandir}/man1/lpstat.1.gz print-lpstatman %{_mandir}/man1/lpstat-cups.1.gz
-%endif
-rm -f %{_localstatedir}/cache/cups/*.ipp %{_localstatedir}/cache/cups/*.cache
exit 0
%post libs -p /sbin/ldconfig
@@ -736,6 +738,10 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man1/ipptool.1.gz
%changelog
+* Tue Dec 4 2012 Tim Waugh <twaugh at redhat.com> 1:1.5.4-16
+- Small error handling improvements in the configuration migration
+ script.
+
* Mon Dec 3 2012 Tim Waugh <twaugh at redhat.com> 1:1.5.4-15
- Applied additional upstream patch for CVE-2012-5519 so that the
RemoteRoot keyword is recognised in the correct configuration file.
More information about the scm-commits
mailing list