From 7e8843a3e525f43f683a81a3d840557754a2a039 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Dec 04 2012 11:23:03 +0000 Subject: Small error handling improvements in the configuration migration script. --- diff --git a/cups.spec b/cups.spec index c2557eb..52446c3 100644 --- a/cups.spec +++ b/cups.spec @@ -19,7 +19,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.5.4 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 Group: System Environment/Daemons Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -445,6 +445,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 @@ -463,49 +489,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 -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 @@ -702,6 +704,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/ipptool.1.gz %changelog +* Tue Dec 4 2012 Tim Waugh 1:1.5.4-10 +- Small error handling improvements in the configuration migration + script. + * Mon Dec 3 2012 Tim Waugh 1:1.5.4-9 - Applied additional upstream patch for CVE-2012-5519 so that the RemoteRoot keyword is recognised in the correct configuration file.