From c8cf6b41b080ab99778d816a4bc1e22968d749a1 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Dec 04 2012 11:19:28 +0000 Subject: Small error handling improvements in the configuration migration script. --- diff --git a/cups.spec b/cups.spec index f9542cc..787e379 100644 --- a/cups.spec +++ b/cups.spec @@ -12,7 +12,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.5.4 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv2 Group: System Environment/Daemons Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -483,6 +483,29 @@ php --no-php-ini \ %post +%systemd_post %{name}.path %{name}.socket %{name}.service + +# 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,46 +524,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" <> "$OUT" <> "$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 -%systemd_post %{name}.path %{name}.socket %{name}.service - -# 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 @@ -730,6 +732,10 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Tue Dec 4 2012 Tim Waugh 1:1.5.4-20 +- Small error handling improvements in the configuration migration + script. + * Mon Dec 3 2012 Jiri Popelka 1:1.5.4-19 - move ipptoolfile(5) to ipptool subpackage