Accepting request 1058853 from home:mbussolotto:branches:Java:packages
- set logrotate for localhost.log, manager.log, host-manager.log and localhost_access_log.txt - use logrotate for catalina.out * update tomcat-serverxml-tool and spec to configure server.xml - Added patch: * tomcat-9.0-logrotate_everything.patch * tomcat-serverxml-tool.tar.gz - Removed: * tomcat-serverxml-tool-1.0.tar.gz OBS-URL: https://build.opensuse.org/request/show/1058853 OBS-URL: https://build.opensuse.org/package/show/Java:packages/tomcat?expand=0&rev=250
This commit is contained in:
parent
7044f5b497
commit
503278cde3
12
tomcat-9.0-logrotate_everything.patch
Normal file
12
tomcat-9.0-logrotate_everything.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Index: apache-tomcat-9.0.43-src/conf/logging.properties
|
||||||
|
===================================================================
|
||||||
|
--- apache-tomcat-9.0.43-src.orig/conf/logging.properties
|
||||||
|
+++ apache-tomcat-9.0.43-src/conf/logging.properties
|
||||||
|
@@ -80,3 +80,7 @@ org.apache.catalina.core.ContainerBase.[
|
||||||
|
|
||||||
|
1catalina.org.apache.juli.AsyncFileHandler.suffix = out
|
||||||
|
1catalina.org.apache.juli.AsyncFileHandler.rotatable = false
|
||||||
|
+
|
||||||
|
+2localhost.org.apache.juli.AsyncFileHandler.rotatable = false
|
||||||
|
+3manager.org.apache.juli.AsyncFileHandler.rotatable = false
|
||||||
|
+4host-manager.org.apache.juli.AsyncFileHandler.rotatable = false
|
@ -1,10 +1,10 @@
|
|||||||
@@@TCLOG@@@/catalina.out {
|
@@@TCLOG@@@/catalina.out @@@TCLOG@@@/localhost_access_log.txt @@@TCLOG@@@/host-manager.log @@@TCLOG@@@/localhost.log @@@TCLOG@@@/manager.log{
|
||||||
notifempty
|
notifempty
|
||||||
copytruncate
|
copytruncate
|
||||||
weekly
|
weekly
|
||||||
rotate 52
|
rotate 52
|
||||||
compress
|
compress
|
||||||
missingok
|
missingok
|
||||||
su root tomcat
|
su tomcat tomcat
|
||||||
create 0644 tomcat tomcat
|
create 0644 tomcat tomcat
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:bcfb8ac5f9f02359be4dd81ba5feac083f23ffab2b4eee4f79932035d4e642af
|
|
||||||
size 9260
|
|
@ -4,41 +4,30 @@ JAR=@LIBEXECDIR@/tomcat/serverxmltool.jar
|
|||||||
SERVERXML=/etc/tomcat/server.xml
|
SERVERXML=/etc/tomcat/server.xml
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
echo "Usage: <script> add|remove docBase path [contextXmlFile]"
|
echo "Usage: <script> file.xslt [arg=value]..."
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z "$1" || -z "$2" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CMD="$1"
|
XSLT="$1"
|
||||||
DOCBASE="$2"
|
ATTRIBUTE="${@:2}"
|
||||||
CTXPATH="$3"
|
|
||||||
CONTEXTXML=${4:-''}
|
|
||||||
|
|
||||||
if [ "$CMD" = "add" ]; then
|
|
||||||
XSLT="add-context.xslt"
|
|
||||||
elif [ "$CMD" = "remove" ]; then
|
|
||||||
XSLT="remove-context.xslt"
|
|
||||||
else
|
|
||||||
usage
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
SUFIX=$(date +%H%M%S%N)
|
SUFIX=$(date +%H%M%S%N)
|
||||||
rm -f ${SERVERXML}.new${SUFIX} ${SERVERXML}.old${SUFIX}
|
rm -f ${SERVERXML}.new${SUFIX} ${SERVERXML}.old${SUFIX}
|
||||||
|
|
||||||
/usr/bin/java -jar $JAR $XSLT $SERVERXML $DOCBASE $CTXPATH $CONTEXTXML > ${SERVERXML}.new${SUFIX}
|
/usr/bin/java -jar $JAR $XSLT $SERVERXML $ATTRIBUTE > ${SERVERXML}.new${SUFIX}
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
mv $SERVERXML ${SERVERXML}.old${SUFIX}
|
mv $SERVERXML ${SERVERXML}.old${SUFIX}
|
||||||
mv ${SERVERXML}.new${SUFIX} $SERVERXML
|
mv ${SERVERXML}.new${SUFIX} $SERVERXML
|
||||||
rm ${SERVERXML}.old${SUFIX}
|
rm ${SERVERXML}.old${SUFIX}
|
||||||
if [ "$CMD" = "add" ]; then
|
if [[ -z "$ATTRIBUTE" ]]; then
|
||||||
echo "Added webapp $CTXPATH from $DOCBASE to $SERVERXML."
|
echo "Use $XSLT with no attribute"
|
||||||
else
|
else
|
||||||
echo "Removed webapp $CTXPATH from $SERVERXML."
|
echo "Use $XSLT with attribute $ATTRIBUTE"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$SERVERXML was not modified."
|
echo "$SERVERXML was not modified."
|
||||||
|
3
tomcat-serverxml-tool.tar.gz
Normal file
3
tomcat-serverxml-tool.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:af80c193df6ec80dd931ec4daa730b21d837eaf8862c87533950e213967bc946
|
||||||
|
size 15243
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Dec 23 08:20:55 UTC 2022 - Michele Bussolotto <michele.bussolotto@suse.com>
|
||||||
|
|
||||||
|
- set logrotate for localhost.log, manager.log, host-manager.log and localhost_access_log.txt
|
||||||
|
- use logrotate for catalina.out
|
||||||
|
* update tomcat-serverxml-tool and spec to configure server.xml
|
||||||
|
- Added patch:
|
||||||
|
* tomcat-9.0-logrotate_everything.patch
|
||||||
|
* tomcat-serverxml-tool.tar.gz
|
||||||
|
- Removed:
|
||||||
|
* tomcat-serverxml-tool-1.0.tar.gz
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Nov 29 14:46:26 UTC 2022 - Michele Bussolotto <michele.bussolotto@suse.com>
|
Tue Nov 29 14:46:26 UTC 2022 - Michele Bussolotto <michele.bussolotto@suse.com>
|
||||||
|
|
||||||
|
41
tomcat.spec
41
tomcat.spec
@ -24,7 +24,6 @@
|
|||||||
%define minor_version 0
|
%define minor_version 0
|
||||||
%define micro_version 43
|
%define micro_version 43
|
||||||
%define packdname apache-tomcat-%{version}-src
|
%define packdname apache-tomcat-%{version}-src
|
||||||
%define serverxmltool_version 1.0
|
|
||||||
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/
|
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/
|
||||||
%global basedir /srv/%{name}
|
%global basedir /srv/%{name}
|
||||||
%define appdir %{basedir}/webapps
|
%define appdir %{basedir}/webapps
|
||||||
@ -63,7 +62,7 @@ Source21: tomcat-functions
|
|||||||
Source30: tomcat-preamble
|
Source30: tomcat-preamble
|
||||||
Source31: tomcat-server
|
Source31: tomcat-server
|
||||||
Source32: tomcat-named.service
|
Source32: tomcat-named.service
|
||||||
Source33: https://gitlab.suse.de/galaxy/tomcat-serverxml-tool/-/archive/%{serverxmltool_version}/tomcat-serverxml-tool-%{serverxmltool_version}.tar.gz
|
Source33: tomcat-serverxml-tool.tar.gz
|
||||||
Source34: tomcat-serverxml-tool.sh.in
|
Source34: tomcat-serverxml-tool.sh.in
|
||||||
Source1000: tomcat-rpmlintrc
|
Source1000: tomcat-rpmlintrc
|
||||||
Source1001: https://archive.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz.asc
|
Source1001: https://archive.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz.asc
|
||||||
@ -91,6 +90,7 @@ Patch12: tomcat-9.0-hardening_getResources.patch
|
|||||||
Patch13: tomcat-9.0.43-CVE-2021-43980.patch
|
Patch13: tomcat-9.0.43-CVE-2021-43980.patch
|
||||||
Patch14: tomcat-9.0.43-CVE-2022-42252.patch
|
Patch14: tomcat-9.0.43-CVE-2022-42252.patch
|
||||||
Patch15: tomcat-9.0-fix_catalina.patch
|
Patch15: tomcat-9.0-fix_catalina.patch
|
||||||
|
Patch16: tomcat-9.0-logrotate_everything.patch
|
||||||
|
|
||||||
BuildRequires: ant >= 1.8.1
|
BuildRequires: ant >= 1.8.1
|
||||||
BuildRequires: ant-antlr
|
BuildRequires: ant-antlr
|
||||||
@ -272,6 +272,7 @@ find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "
|
|||||||
%patch13 -p1
|
%patch13 -p1
|
||||||
%patch14 -p1
|
%patch14 -p1
|
||||||
%patch15 -p1
|
%patch15 -p1
|
||||||
|
%patch16 -p1
|
||||||
|
|
||||||
# remove date from docs
|
# remove date from docs
|
||||||
sed -i -e '/build-date/ d' webapps/docs/tomcat-docs.xsl
|
sed -i -e '/build-date/ d' webapps/docs/tomcat-docs.xsl
|
||||||
@ -335,9 +336,9 @@ jar cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.wa
|
|||||||
popd
|
popd
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}/src
|
pushd %{_builddir}/tomcat-serverxml-tool/src
|
||||||
javac -source %{javac_target} -target %{javac_target} com/suse/tcserverxml/ApplyStylesheet.java
|
javac -source %{javac_target} -target %{javac_target} com/suse/tcserverxml/ApplyStylesheet.java
|
||||||
jar cfe %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}/serverxmltool.jar com.suse.tcserverxml.ApplyStylesheet com/suse/tcserverxml/ApplyStylesheet.class com/suse/tcserverxml/add-context.xslt com/suse/tcserverxml/remove-context.xslt
|
jar cfe %{_builddir}/tomcat-serverxml-tool/serverxmltool.jar com.suse.tcserverxml.ApplyStylesheet com/suse/tcserverxml/ApplyStylesheet.class com/suse/tcserverxml/add-context.xslt com/suse/tcserverxml/remove-context.xslt com/suse/tcserverxml/add-valve-rotatable-false.xslt
|
||||||
popd
|
popd
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -587,7 +588,7 @@ ln -s -f %{_sysconfdir}/alternatives/jsp %{buildroot}%{_javadir}/%{name}-jsp.jar
|
|||||||
ln -s -f %{_sysconfdir}/alternatives/servlet.jar %{buildroot}%{_javadir}/servlet.jar
|
ln -s -f %{_sysconfdir}/alternatives/servlet.jar %{buildroot}%{_javadir}/servlet.jar
|
||||||
|
|
||||||
# Install tool used to edit server.xml
|
# Install tool used to edit server.xml
|
||||||
pushd %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}
|
pushd %{_builddir}/tomcat-serverxml-tool
|
||||||
cat %{SOURCE34} | sed 's#@LIBEXECDIR@#%{_libexecdir}#g' >tomcat-serverxml-tool.sh
|
cat %{SOURCE34} | sed 's#@LIBEXECDIR@#%{_libexecdir}#g' >tomcat-serverxml-tool.sh
|
||||||
install -m 0755 tomcat-serverxml-tool.sh \
|
install -m 0755 tomcat-serverxml-tool.sh \
|
||||||
%{buildroot}%{_libexecdir}/%{name}/serverxml-tool.sh
|
%{buildroot}%{_libexecdir}/%{name}/serverxml-tool.sh
|
||||||
@ -677,35 +678,39 @@ rm -f \
|
|||||||
%{libdir}/\[ecj\].jar >/dev/null 2>&1
|
%{libdir}/\[ecj\].jar >/dev/null 2>&1
|
||||||
|
|
||||||
%post webapps
|
%post webapps
|
||||||
%{serverxmltool} add %{tomcatappdir}/ROOT /
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/ROOT path=/
|
||||||
%{serverxmltool} add %{tomcatappdir}/sample /sample
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/sample path=/sample
|
||||||
%{serverxmltool} add %{tomcatappdir}/examples /examples
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/examples path=/examples
|
||||||
|
|
||||||
%postun webapps
|
%postun webapps
|
||||||
if [ $1 -eq 0 ]; then # uninstall only
|
if [ $1 -eq 0 ]; then # uninstall only
|
||||||
%{serverxmltool} remove %{tomcatappdir}/ROOT /
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/ROOT path=/
|
||||||
%{serverxmltool} remove %{tomcatappdir}/sample /sample
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/sample path=/sample
|
||||||
%{serverxmltool} remove %{tomcatappdir}/examples /examples
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/examples path=/examples
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%post admin-webapps
|
%post admin-webapps
|
||||||
%{serverxmltool} add %{tomcatappdir}/host-manager /host-manager %{tomcatappdir}/host-manager/META-INF/context.xml
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/host-manager path=/host-manager contextXml=%{tomcatappdir}/host-manager/META-INF/context.xml
|
||||||
%{serverxmltool} add %{tomcatappdir}/manager /manager %{tomcatappdir}/manager/META-INF/context.xml
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/manager path=/manager contextXml=%{tomcatappdir}/manager/META-INF/context.xml
|
||||||
|
|
||||||
|
|
||||||
%postun admin-webapps
|
%postun admin-webapps
|
||||||
if [ $1 -eq 0 ]; then # uninstall only
|
if [ $1 -eq 0 ]; then # uninstall only
|
||||||
%{serverxmltool} remove %{tomcatappdir}/host-manager /host-manager
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/host-manager path=/host-manager
|
||||||
%{serverxmltool} remove %{tomcatappdir}/manager /manager
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/manager path=/manager
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%post docs-webapp
|
%post docs-webapp
|
||||||
%{serverxmltool} add %{tomcatappdir}/docs /docs
|
%{serverxmltool} add-context.xslt docBase=%{tomcatappdir}/docs path=/docs
|
||||||
|
|
||||||
%postun docs-webapp
|
%postun docs-webapp
|
||||||
if [ $1 -eq 0 ]; then # uninstall only
|
if [ $1 -eq 0 ]; then # uninstall only
|
||||||
%{serverxmltool} remove %{tomcatappdir}/docs /docs
|
%{serverxmltool} remove-context.xslt docBase=%{tomcatappdir}/docs path=/docs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%posttrans
|
||||||
|
%{serverxmltool} add-valve-rotatable-false.xslt
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc {LICENSE,NOTICE,RELEASE*}
|
%doc {LICENSE,NOTICE,RELEASE*}
|
||||||
%attr(0755,root,root) %{_bindir}/%{name}-digest
|
%attr(0755,root,root) %{_bindir}/%{name}-digest
|
||||||
@ -727,7 +732,7 @@ fi
|
|||||||
%attr(0755,root,tomcat) %dir %{basedir}
|
%attr(0755,root,tomcat) %dir %{basedir}
|
||||||
%attr(0755,root,tomcat) %dir %{confdir}
|
%attr(0755,root,tomcat) %dir %{confdir}
|
||||||
%attr(0775,root,tomcat) %dir %{appdir}
|
%attr(0775,root,tomcat) %dir %{appdir}
|
||||||
%attr(0770,tomcat,root) %dir %{logdir}
|
%attr(0770,tomcat,tomcat) %dir %{logdir}
|
||||||
%attr(0660,tomcat,tomcat) %{logdir}/catalina.out
|
%attr(0660,tomcat,tomcat) %{logdir}/catalina.out
|
||||||
%attr(0770,root,tomcat) %dir %{cachedir}
|
%attr(0770,root,tomcat) %dir %{cachedir}
|
||||||
%attr(0775,root,tomcat) %dir %{cachedir}/Catalina
|
%attr(0775,root,tomcat) %dir %{cachedir}/Catalina
|
||||||
|
Loading…
Reference in New Issue
Block a user