diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 21:04:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-05 21:04:41 +0000 |
commit | a51106ed6932423c25c7d464ef5c2d609bd62924 (patch) | |
tree | b40cd0bcb45e9d56ee030c434e79351cfe57e1b3 /heartbeat/nfsserver | |
parent | Adding upstream version 1:4.13.0. (diff) | |
download | resource-agents-upstream.tar.xz resource-agents-upstream.zip |
Adding upstream version 1:4.14.0.upstream/1%4.14.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'heartbeat/nfsserver')
-rwxr-xr-x | heartbeat/nfsserver | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver index 8838195..5793d7a 100755 --- a/heartbeat/nfsserver +++ b/heartbeat/nfsserver @@ -711,8 +711,17 @@ inject_unshare_uts_name_into_systemd_units () test -d "$dir" || mkdir -p "$dir" test -e "$dropin" && rm -f "$dropin" - # NOTE: additional ExecStart= might exist in the drop-in files, eg. openSUSE - edited_exec_start=$(systemctl cat $svc | sed -ne "s#^ExecStart=\\([-+:!@]*\\)\\(.\+\\)#ExecStart=\\1/usr/bin/unshare --uts /bin/sh -c 'hostname \${NFS_SERVER_SCOPE}; exec \"\$@\"' -- \\2#p" | tail -1) + # NOTE: multiple ExecStart may exist, + # even additional `ExecStart=` to reset the list might exist in the drop-in files. + # We are interested in only the "currently relevant" set of ExecStart. + local unshare_uts_set_hostname='/usr/bin/unshare --uts /bin/sh -c '\''hostname ${NFS_SERVER_SCOPE}; exec "$@"'\'' -- ' + edited_exec_start=$(systemctl cat $svc \ + | sed -n \ + -e '/^ExecStart=/ H;' \ + -e '/^ExecStart=[[:space:]]*$/ {s/.*//;h};' \ + -e '${g;s/^\n//;p}' \ + | sed -e 's#^\(ExecStart=[-+:!@]*\)\(.\+\)#\1'"$unshare_uts_set_hostname"'\2#' + ) cat > "$dropin" <<___ [Service] |