Compare commits
No commits in common. "a582523a0ebda2cc738a6526b92d52a07a2cc618" and "7f48f4b300aac8b55e6afd0c85c2558feea8b295" have entirely different histories.
a582523a0e
...
7f48f4b300
27
functions.sh
27
functions.sh
|
@ -44,38 +44,15 @@ ensure_systemd_as_user_dir_exists () {
|
||||||
|
|
||||||
# sed or die trying
|
# sed or die trying
|
||||||
sed_in_place () {
|
sed_in_place () {
|
||||||
${podman_unshare} grep -q "${1}" "${3}"
|
grep -q "${1}" "${3}"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
${podman_unshare} sed -i -e "s|${1}|${2}|g" ${3}
|
sed -i -e "s|${1}|${2}|g" ${3}
|
||||||
else
|
else
|
||||||
echo "Pattern ${1} not found in file ${3}, exiting."
|
echo "Pattern ${1} not found in file ${3}, exiting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
||||||
check_systemd_unit_exists () {
|
check_systemd_unit_exists () {
|
||||||
systemctl --user cat -- ${1} &> /dev/null
|
systemctl --user cat -- ${1} &> /dev/null
|
||||||
|
|
Loading…
Reference in a new issue