From ac80d199a728e06d413486b911d5402aef3b7dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Thu, 12 Dec 2024 13:55:20 +0100 Subject: [PATCH] [tomcat] Stop adding sed explicitly into tomcat --- src/bci_build/package/apache_tomcat.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/bci_build/package/apache_tomcat.py b/src/bci_build/package/apache_tomcat.py index 37732d5e2..1e3125280 100644 --- a/src/bci_build/package/apache_tomcat.py +++ b/src/bci_build/package/apache_tomcat.py @@ -96,8 +96,6 @@ def _get_java_packages(jre_major: int) -> list[str]: if tomcat_ver == _TOMCAT_VERSIONS[0] else f"tomcat{tomcat_ver.partition('.')[0]}" ), - # currently needed by custom_end - "sed", Package("util-linux", PackageType.DELETE), ] + _get_java_packages(jre_version), @@ -120,11 +118,15 @@ def _get_java_packages(jre_major: int) -> list[str]: }, custom_end=rf"""{DOCKERFILE_RUN} mkdir -p /var/log/tomcat; chown --recursive tomcat:tomcat /var/log/tomcat {DOCKERFILE_RUN} ln -s {_CATALINA_HOME} /usr/local/tomcat -{DOCKERFILE_RUN} \ - sed -i /usr/share/tomcat/conf/logging.properties \ - -e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler|' \ - -e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler|' \ - -e 's|org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[/host-manager\]\.handlers =.*|org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler|' +{DOCKERFILE_RUN} """ + + r"""while IFS= read -r line; do \ + line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = java.util.logging.ConsoleHandler}; \ + line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[\/manager\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = java.util.logging.ConsoleHandler}; \ + line=${line/org\.apache\.catalina\.core\.ContainerBase\.\[Catalina\]\.\[localhost\]\.\[\/host-manager\]\.handlers =*/org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = java.util.logging.ConsoleHandler}; \ + echo "$line" >> /tmp/logging.properties; \ +done < /usr/share/tomcat/conf/logging.properties; \ + +mv /tmp/logging.properties /usr/share/tomcat/conf/logging.properties WORKDIR $CATALINA_HOME """,