>From 360045787253222b0fa9da168ef7b4c9f49139dc Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Fri, 16 Mar 2012 13:20:38 -0400
Subject: [PATCH] BZ 802396 - Change location of TOMCAT_LOG to match tomcat6
 changes

Tomcat6 has changed the changed the location of the TOMCAT_LOG, and
it should no longer point to catalina.out.  This initially caused
dogtag to break because the code to chown TOMCAT_LOG to TOMCAT_USER
was removed.  Added code to spec file to fix existing instances.

Renamed older patches.
---
 pki/base/ca/shared/conf/tomcat6.conf               |    2 +-
 pki/base/kra/shared/conf/tomcat6.conf              |    2 +-
 pki/base/ocsp/shared/conf/tomcat6.conf             |    2 +-
 pki/base/tks/shared/conf/tomcat6.conf              |    2 +-
 ...op-icon.patch => pki-core-9.0.3-bz745677.patch} |    0
 ...guments.patch => pki-core-9.0.3-bz769388.patch} |    0
 ...011-174.patch => pki-core-9.0.3-bz771790.patch} |    0
 pki/specs/pki-core.spec                            |   29 ++++++++++++++++---
 pki/specs/pki-kra.spec                             |   21 +++++++++++++-
 pki/specs/pki-ocsp.spec                            |   21 +++++++++++++-
 pki/specs/pki-tks.spec                             |   21 +++++++++++++-
 11 files changed, 85 insertions(+), 15 deletions(-)
 rename pki/patches/{0026-BZ-745677-Remove-CA-desktop-icon.patch => pki-core-9.0.3-bz745677.patch} (100%)
 rename pki/patches/{0027-BZ-769388-pki-silent-does-not-properly-escape-command-line-arguments.patch => pki-core-9.0.3-bz769388.patch} (100%)
 rename pki/patches/{0025-BZ-771790-sslget-does-not-work-after-FEDORA-2011-174.patch => pki-core-9.0.3-bz771790.patch} (100%)

diff --git a/pki/base/ca/shared/conf/tomcat6.conf b/pki/base/ca/shared/conf/tomcat6.conf
index b3aa82df7b989a258cdbe569bf238ad8badd89f5..2d7def5ec9256dc59d89c3197c5e723c113a3779 100644
--- a/pki/base/ca/shared/conf/tomcat6.conf
+++ b/pki/base/ca/shared/conf/tomcat6.conf
@@ -48,7 +48,7 @@ TOMCAT_USER="[PKI_USER]"
 CATALINA_PID="[TOMCAT_PIDFILE]"
 
 # Set the tomcat log file
-TOMCAT_LOG="[TOMCAT_LOG_DIR]/catalina.out"
+TOMCAT_LOG="[TOMCAT_LOG_DIR]/tomcat-initd.log"
 
 # Connector port is 8080 for this tomcat6 instance
 #CONNECTOR_PORT="8080"
diff --git a/pki/base/kra/shared/conf/tomcat6.conf b/pki/base/kra/shared/conf/tomcat6.conf
index b3aa82df7b989a258cdbe569bf238ad8badd89f5..2d7def5ec9256dc59d89c3197c5e723c113a3779 100644
--- a/pki/base/kra/shared/conf/tomcat6.conf
+++ b/pki/base/kra/shared/conf/tomcat6.conf
@@ -48,7 +48,7 @@ TOMCAT_USER="[PKI_USER]"
 CATALINA_PID="[TOMCAT_PIDFILE]"
 
 # Set the tomcat log file
-TOMCAT_LOG="[TOMCAT_LOG_DIR]/catalina.out"
+TOMCAT_LOG="[TOMCAT_LOG_DIR]/tomcat-initd.log"
 
 # Connector port is 8080 for this tomcat6 instance
 #CONNECTOR_PORT="8080"
diff --git a/pki/base/ocsp/shared/conf/tomcat6.conf b/pki/base/ocsp/shared/conf/tomcat6.conf
index b3aa82df7b989a258cdbe569bf238ad8badd89f5..2d7def5ec9256dc59d89c3197c5e723c113a3779 100644
--- a/pki/base/ocsp/shared/conf/tomcat6.conf
+++ b/pki/base/ocsp/shared/conf/tomcat6.conf
@@ -48,7 +48,7 @@ TOMCAT_USER="[PKI_USER]"
 CATALINA_PID="[TOMCAT_PIDFILE]"
 
 # Set the tomcat log file
-TOMCAT_LOG="[TOMCAT_LOG_DIR]/catalina.out"
+TOMCAT_LOG="[TOMCAT_LOG_DIR]/tomcat-initd.log"
 
 # Connector port is 8080 for this tomcat6 instance
 #CONNECTOR_PORT="8080"
diff --git a/pki/base/tks/shared/conf/tomcat6.conf b/pki/base/tks/shared/conf/tomcat6.conf
index b3aa82df7b989a258cdbe569bf238ad8badd89f5..2d7def5ec9256dc59d89c3197c5e723c113a3779 100644
--- a/pki/base/tks/shared/conf/tomcat6.conf
+++ b/pki/base/tks/shared/conf/tomcat6.conf
@@ -48,7 +48,7 @@ TOMCAT_USER="[PKI_USER]"
 CATALINA_PID="[TOMCAT_PIDFILE]"
 
 # Set the tomcat log file
-TOMCAT_LOG="[TOMCAT_LOG_DIR]/catalina.out"
+TOMCAT_LOG="[TOMCAT_LOG_DIR]/tomcat-initd.log"
 
 # Connector port is 8080 for this tomcat6 instance
 #CONNECTOR_PORT="8080"
diff --git a/pki/patches/0026-BZ-745677-Remove-CA-desktop-icon.patch b/pki/patches/pki-core-9.0.3-bz745677.patch
similarity index 100%
rename from pki/patches/0026-BZ-745677-Remove-CA-desktop-icon.patch
rename to pki/patches/pki-core-9.0.3-bz745677.patch
diff --git a/pki/patches/0027-BZ-769388-pki-silent-does-not-properly-escape-command-line-arguments.patch b/pki/patches/pki-core-9.0.3-bz769388.patch
similarity index 100%
rename from pki/patches/0027-BZ-769388-pki-silent-does-not-properly-escape-command-line-arguments.patch
rename to pki/patches/pki-core-9.0.3-bz769388.patch
diff --git a/pki/patches/0025-BZ-771790-sslget-does-not-work-after-FEDORA-2011-174.patch b/pki/patches/pki-core-9.0.3-bz771790.patch
similarity index 100%
rename from pki/patches/0025-BZ-771790-sslget-does-not-work-after-FEDORA-2011-174.patch
rename to pki/patches/pki-core-9.0.3-bz771790.patch
diff --git a/pki/specs/pki-core.spec b/pki/specs/pki-core.spec
index b049bc4afa4b5d5f4b8bb7ac98942f23c1a169b7..0adda98120d04974cbbcf2fb2450b62b4f8a3185 100644
--- a/pki/specs/pki-core.spec
+++ b/pki/specs/pki-core.spec
@@ -1,6 +1,6 @@
 Name:             pki-core
 Version:          9.0.3
-Release:          23%{?dist}
+Release:          24%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -56,9 +56,10 @@ Patch21:          %{name}-%{version}-r2161.patch
 Patch22:          %{name}-%{version}-r2163.patch
 Patch23:          %{name}-%{version}-r2182.patch
 Patch24:          %{name}-%{version}-r2249.patch
-Patch25:          0025-BZ-771790-sslget-does-not-work-after-FEDORA-2011-174.patch
-Patch26:          0026-BZ-745677-Remove-CA-desktop-icon.patch
-Patch27:          0027-BZ-769388-pki-silent-does-not-properly-escape-command-line-arguments.patch
+Patch25:          %{name}-%{version}-bz771790.patch
+Patch26:          %{name}-%{version}-bz745677.patch
+Patch27:          %{name}-%{version}-bz769388.patch
+Patch28:          %{name}-%{version}-bz802396.patch
 
 %if 0%{?rhel}
 ExcludeArch:      ppc ppc64 s390 s390x
@@ -431,6 +432,7 @@ This package is a part of the PKI Core used by the Certificate System.
 %patch25 -p2 -b .p25
 %patch26 -p2 -b .p26
 %patch27 -p2 -b .p27
+%patch28 -p2 -b .p28
 
 
 %clean
@@ -471,6 +473,19 @@ echo "D /var/run/pki 0755 root root -"     >> %{buildroot}%{_sysconfdir}/tmpfile
 echo "D /var/run/pki/ca 0755 root root -"  >> %{buildroot}%{_sysconfdir}/tmpfiles.d/pki-ca.conf
 %endif
 
+# tomcat6 has changed how TOMCAT_LOG is used.
+# Need to adjust accordingly
+# This macro will be executed in the postinstall scripts
+%define fix_tomcat_log() (                                                   \
+if [ -d /etc/sysconfig/pki/%i ]; then                                        \
+  for F in `find /etc/sysconfig/pki/%1 -type f`; do                          \
+    instance=`basename $F`                                                   \
+    if [ -f /etc/sysconfig/$instance ]; then                                 \
+        sed -i -e 's/catalina.out/tomcat-initd.log/' /etc/sysconfig/$instance \
+    fi                                                                       \
+  done                                                                       \
+fi                                                                           \
+)
 
 %pre -n pki-selinux
 %saveFileContext targeted
@@ -497,7 +512,7 @@ fi
 %post -n pki-ca
 # This adds the proper /etc/rc*.d links for the script
 /sbin/chkconfig --add pki-cad || :
-
+%fix_tomcat_log ca
 
 %preun -n pki-ca
 if [ $1 = 0 ] ; then
@@ -511,6 +526,7 @@ if [ "$1" -ge "1" ] ; then
     /sbin/service pki-cad condrestart >/dev/null 2>&1 || :
 fi
 
+ 
 
 %files -n pki-setup
 %defattr(-,root,root,-)
@@ -652,6 +668,9 @@ fi
 
 
 %changelog
+* Fri Mar 16 2012 Ade Lee <alee@redhat.com> 9.0.3-24
+- BZ 802396 - Change location of TOMCAT_LOG to match tomcat6 changes
+
 * Mon Mar  5 2012 Ade Lee <alee@redhat.com> 9.0.3-23
 - Resolves #769388 - pki-silent does not properly escape command-line arguments
   (fixed in Git repo)
diff --git a/pki/specs/pki-kra.spec b/pki/specs/pki-kra.spec
index 302da6e6fcc808c6f77da9beb1827d9b9aba94a3..e29ca108fb43587f84d779b240d57992469634b7 100644
--- a/pki/specs/pki-kra.spec
+++ b/pki/specs/pki-kra.spec
@@ -1,6 +1,6 @@
 Name:             pki-kra
 Version:          9.0.0
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          Certificate System - Data Recovery Manager
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -117,11 +117,25 @@ echo "D /var/run/pki 0755 root root -"      >> %{buildroot}%{_sysconfdir}/tmpfil
 echo "D /var/run/pki/kra 0755 root root -"  >> %{buildroot}%{_sysconfdir}/tmpfiles.d/pki-kra.conf
 %endif
 
+# tomcat6 has changed how TOMCAT_LOG is used.
+# Need to adjust accordingly
+# This macro will be executed in the postinstall scripts
+%define fix_tomcat_log() (                                                   \
+if [ -d /etc/sysconfig/pki/%i ]; then                                        \
+  for F in `find /etc/sysconfig/pki/%1 -type f`; do                          \
+    instance=`basename $F`                                                   \
+    if [ -f /etc/sysconfig/$instance ]; then                                 \
+        sed -i -e 's/catalina.out/tomcat-initd.log/' /etc/sysconfig/$instance \
+    fi                                                                       \
+  done                                                                       \
+fi                                                                           \
+)
+
 
 %post
 # This adds the proper /etc/rc*.d links for the script
 /sbin/chkconfig --add pki-krad || :
-
+%fix_tomcat_log kra
 
 %preun
 if [ $1 = 0 ] ; then
@@ -159,6 +173,9 @@ fi
 
 
 %changelog
+* Fri Mar 16 2012 Ade Lee <alee@redhat.com> 9.0.0-3
+- BZ 802396 - Change location of TOMCAT_LOG to match tomcat6 changes
+
 * Fri Aug 5 2011 Matthew Harmsen <mharmsen@redhat.com> 9.0.0-2
 - Bugzilla Bug #693835 - /var/log/tomcat6/catalina.out owned by pkiuser
 
diff --git a/pki/specs/pki-ocsp.spec b/pki/specs/pki-ocsp.spec
index edf57d5c0bdcce6eeecd558ef2b639237efec5f7..3ae9e5204facca9d804081b54600e3086ddfa2eb 100644
--- a/pki/specs/pki-ocsp.spec
+++ b/pki/specs/pki-ocsp.spec
@@ -1,6 +1,6 @@
 Name:             pki-ocsp
 Version:          9.0.0
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          Certificate System - Online Certificate Status Protocol Manager
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -124,11 +124,25 @@ echo "D /var/run/pki 0755 root root -"       >> %{buildroot}%{_sysconfdir}/tmpfi
 echo "D /var/run/pki/ocsp 0755 root root -"  >> %{buildroot}%{_sysconfdir}/tmpfiles.d/pki-ocsp.conf
 %endif
 
+# tomcat6 has changed how TOMCAT_LOG is used.
+# Need to adjust accordingly
+# This macro will be executed in the postinstall scripts
+%define fix_tomcat_log() (                                                   \
+if [ -d /etc/sysconfig/pki/%i ]; then                                        \
+  for F in `find /etc/sysconfig/pki/%1 -type f`; do                          \
+    instance=`basename $F`                                                   \
+    if [ -f /etc/sysconfig/$instance ]; then                                 \
+        sed -i -e 's/catalina.out/tomcat-initd.log/' /etc/sysconfig/$instance \
+    fi                                                                       \
+  done                                                                       \
+fi                                                                           \
+)
+
 
 %post
 # This adds the proper /etc/rc*.d links for the script
 /sbin/chkconfig --add pki-ocspd || :
-
+%fix_tomcat_log ocsp
 
 %preun
 if [ $1 = 0 ] ; then
@@ -166,6 +180,9 @@ fi
 
 
 %changelog
+* Fri Mar 16 2012 Ade Lee <alee@redhat.com> 9.0.0-3
+- BZ 802396 - Change location of TOMCAT_LOG to match tomcat6 changes
+
 * Fri Aug 5 2011 Matthew Harmsen <mharmsen@redhat.com> 9.0.0-2
 - Bugzilla Bug #693835 - /var/log/tomcat6/catalina.out owned by pkiuser
 
diff --git a/pki/specs/pki-tks.spec b/pki/specs/pki-tks.spec
index 3c02c3d7edf01f231bd7e30a6b2bc50836f62251..cbee245e88c9b5d5eb9207892bd9004ba5aca1b7 100644
--- a/pki/specs/pki-tks.spec
+++ b/pki/specs/pki-tks.spec
@@ -1,6 +1,6 @@
 Name:             pki-tks
 Version:          9.0.0
-Release:          2%{?dist}
+Release:          3%{?dist}
 Summary:          Certificate System - Token Key Service
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -118,11 +118,25 @@ echo "D /var/run/pki 0755 root root -"      >> %{buildroot}%{_sysconfdir}/tmpfil
 echo "D /var/run/pki/tks 0755 root root -"  >> %{buildroot}%{_sysconfdir}/tmpfiles.d/pki-tks.conf
 %endif
 
+# tomcat6 has changed how TOMCAT_LOG is used.
+# Need to adjust accordingly
+# This macro will be executed in the postinstall scripts
+%define fix_tomcat_log() (                                                   \
+if [ -d /etc/sysconfig/pki/%i ]; then                                        \
+  for F in `find /etc/sysconfig/pki/%1 -type f`; do                          \
+    instance=`basename $F`                                                   \
+    if [ -f /etc/sysconfig/$instance ]; then                                 \
+        sed -i -e 's/catalina.out/tomcat-initd.log/' /etc/sysconfig/$instance \
+    fi                                                                       \
+  done                                                                       \
+fi                                                                           \
+)
+
 
 %post
 # This adds the proper /etc/rc*.d links for the script
 /sbin/chkconfig --add pki-tksd || :
-
+%fix_tomcat_log tks
 
 %preun
 if [ $1 = 0 ] ; then
@@ -160,6 +174,9 @@ fi
 
 
 %changelog
+* Fri Mar 16 2012 Ade Lee <alee@redhat.com> 9.0.0-3
+- BZ 802396 - Change location of TOMCAT_LOG to match tomcat6 changes
+
 * Fri Aug 5 2011 Matthew Harmsen <mharmsen@redhat.com> 9.0.0-2
 - Bugzilla Bug #693835 - /var/log/tomcat6/catalina.out owned by pkiuser
 
-- 
1.7.6.4

