Skip to content

Commit

Permalink
[tomcat] Stop adding sed explicitly into tomcat
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Dec 12, 2024
1 parent e05e614 commit ac80d19
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/bci_build/package/apache_tomcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
""",
Expand Down

0 comments on commit ac80d19

Please sign in to comment.