mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-03-26 21:33:05 +00:00
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.
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user