Skip to content
Snippets Groups Projects
Commit 8e310227 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

infra/image/shcontainer: Safer host removal from /etc/hosts

The sed command for host removal from PR #1364 is used now. This makes
sure that only full matches are removed and not substring matches.
parent 89cfb5f4
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ container_start() {
hostname=$(podman inspect "${name}" --format "{{.Config.Hostname}}")
if [ -n "${ip}" ] && [ -n "${hostname}" ]; then
cmd=$(cat <<EOF
sed -i -e "/[ \t]${hostname}/d" /etc/hosts
sed -i -E "/\s+${hostname}(\s|$)/d" /etc/hosts
echo -e "$ip\t${hostname} ${hostname%%.*}" >> /etc/hosts
EOF
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment