Skip to content

Commit

Permalink
Make sure calls to sed are portable.
Browse files Browse the repository at this point in the history
Call sed with `-E` to enable POSIX-defined Extended Regular Expressions,
to be sure that the calls work in the same across GNU/Linux and macOS.
  • Loading branch information
gouttegd committed Oct 31, 2024
1 parent eb4f9d8 commit c8e5b72
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions template/src/ontology/run.sh.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ done
# Proxy settings for Java applications
[ -z "$HTTP_PROXY" ] && [ -n "$http_proxy" ] && HTTP_PROXY=$http_proxy
if [ -n "$HTTP_PROXY" ]; then
proxy_host=$(echo $HTTP_PROXY | sed 's,^https\?://,,; s,:[0-9]\+$,,')
proxy_port=$(echo $HTTP_PROXY | sed 's,^.*:\([0-9]\+\)$,\1,')
proxy_host=$(echo $HTTP_PROXY | sed -E 's,^https?://,,; s,:[0-9]+$,,')
proxy_port=$(echo $HTTP_PROXY | sed -E 's,^.*:([0-9]+)$,\1,')
ODK_JAVA_OPTS="$ODK_JAVA_OPTS -Dhttp.proxyHost=$proxy_host"
[ "$proxy_port" != "$proxy_host" ] && ODK_JAVA_OPTS="$ODK_JAVA_OPTS -Dhttp.proxyPort=$proxy_port"
fi
[ -z "$HTTPS_PROXY" ] && [ -n "$https_proxy" ] && HTTPS_PROXY=$https_proxy
if [ -n "$HTTPS_PROXY" ]; then
proxy_host=$(echo $HTTPS_PROXY | sed 's,^https\?://,,; s,:[0-9]\+$,,')
proxy_port=$(echo $HTTPS_PROXY | sed 's,^.*:\([0-9]\+\)$,\1,')
proxy_host=$(echo $HTTPS_PROXY | sed -E 's,^https?://,,; s,:[0-9]+$,,')
proxy_port=$(echo $HTTPS_PROXY | sed -E 's,^.*:([0-9]+)$,\1,')
ODK_JAVA_OPTS="$ODK_JAVA_OPTS -Dhttps.proxyHost=$proxy_host"
[ "$proxy_port" != "$proxy_host" ] && ODK_JAVA_OPTS="$ODK_JAVA_OPTS -Dhttps.proxyPort=$proxy_port"
fi
Expand Down

0 comments on commit c8e5b72

Please sign in to comment.