ajout functions sed multi + podman unsahre
This commit is contained in:
parent
884e85cca2
commit
a582523a0e
18
functions.sh
18
functions.sh
|
@ -53,11 +53,29 @@ sed_in_place () {
|
|||
fi
|
||||
}
|
||||
|
||||
# podman_unshare prefixed
|
||||
podman_unshare_sed_in_place () {
|
||||
podman_unshare='podman unshare'
|
||||
sed_in_place "${1}" "${2}" "${3}"
|
||||
}
|
||||
|
||||
# sed or die trying
|
||||
sed_in_place_multiline () {
|
||||
${podman_unshare} grep -z -q "${1}" "${3}"
|
||||
if [ $? -eq 0 ]; then
|
||||
${podman_unshare} sed -z -i -e "s|${1}|${2}|g" ${3}
|
||||
else
|
||||
echo "Pattern ${1} not found in file ${3}, exiting."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# podman_unshare prefixed
|
||||
podman_unshare_sed_in_place_multiline () {
|
||||
podman_unshare='podman unshare'
|
||||
sed_in_place_multiline "${1}" "${2}" "${3}"
|
||||
}
|
||||
|
||||
# check: systemd unit exists
|
||||
check_systemd_unit_exists () {
|
||||
systemctl --user cat -- ${1} &> /dev/null
|
||||
|
|
Loading…
Reference in a new issue