Skip to content
Snippets Groups Projects
Unverified Commit 7275bbf6 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman Committed by GitHub
Browse files

Merge pull request #1365 from t-woerner/infra_image_start_hosts_safer_removal

infra/image/shcontainer: Safer host removal from /etc/hosts
parents 89cfb5f4 8e310227
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,7 @@ container_start() { ...@@ -60,7 +60,7 @@ container_start() {
hostname=$(podman inspect "${name}" --format "{{.Config.Hostname}}") hostname=$(podman inspect "${name}" --format "{{.Config.Hostname}}")
if [ -n "${ip}" ] && [ -n "${hostname}" ]; then if [ -n "${ip}" ] && [ -n "${hostname}" ]; then
cmd=$(cat <<EOF 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 echo -e "$ip\t${hostname} ${hostname%%.*}" >> /etc/hosts
EOF EOF
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment