Changed tactics. Sed's -i flag is not cross-platform.
This commit is contained in:
parent
0e11583b1e
commit
f9c945cc86
3 changed files with 5 additions and 10 deletions
|
@ -34,8 +34,7 @@ fi
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
absent)
|
absent)
|
||||||
# remove lines starting with key
|
# remove lines starting with key
|
||||||
echo "sed -i cdist-backup '/^$key\($delimiter\+\)/d' \"$file\""
|
echo "sed '/^$key\($delimiter\+\)/d' \"$file\" | tee \"$file\" > /dev/null"
|
||||||
echo "rm -f \"$file.cdist-backup\""
|
|
||||||
;;
|
;;
|
||||||
present)
|
present)
|
||||||
case "$state_is" in
|
case "$state_is" in
|
||||||
|
@ -45,8 +44,7 @@ case "$state_should" in
|
||||||
;;
|
;;
|
||||||
wrongvalue)
|
wrongvalue)
|
||||||
# change exisiting value
|
# change exisiting value
|
||||||
echo "sed -i cdist-backup \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\""
|
echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" | tee \"$file\" > /dev/null"
|
||||||
echo "rm -f \"$file.cdist-backup\""
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown explorer state: $state_is" >&2
|
echo "Unknown explorer state: $state_is" >&2
|
||||||
|
|
|
@ -32,8 +32,7 @@ DONE
|
||||||
removed)
|
removed)
|
||||||
cat << DONE
|
cat << DONE
|
||||||
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
|
||||||
sed -i cdist-backup '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\""
|
sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" | tee \"\\\$HOME/.bashrc\" > /dev/null"
|
||||||
rm -f \"\\\$HOME/.bashrc.cdist-backup\""
|
|
||||||
DONE
|
DONE
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -32,8 +32,7 @@ case "$state_should" in
|
||||||
present)
|
present)
|
||||||
case "$os" in
|
case "$os" in
|
||||||
archlinux)
|
archlinux)
|
||||||
echo "sed -i cdist-backup 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf"
|
echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf | tee /etc/rc.conf > /dev/null"
|
||||||
echo "rm -f /etc/rc.conf.cdist-backup"
|
|
||||||
;;
|
;;
|
||||||
debian|ubuntu)
|
debian|ubuntu)
|
||||||
echo "update-rc.d \"$name\" defaults >/dev/null"
|
echo "update-rc.d \"$name\" defaults >/dev/null"
|
||||||
|
@ -67,8 +66,7 @@ case "$state_should" in
|
||||||
archlinux)
|
archlinux)
|
||||||
# Replace a) at the beginning b) in the middle c) end d) only
|
# Replace a) at the beginning b) in the middle c) end d) only
|
||||||
# Support @name as well...makes it more ugly, but well...
|
# Support @name as well...makes it more ugly, but well...
|
||||||
echo "sed -i cdist-backup /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/'"
|
echo "sed /etc/rc.conf -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name /\\1/' -e 's/^\\(DAEMONS=(.* \\)@\\{0,1\\}$name \\(.*\\)/\\1\\2/' -e 's/^\\(DAEMONS=(.*\\) @\\{0,1\\}$name)/\\1)/' -e 's/^\\(DAEMONS=(\\)@\\{0,1\\}$name)/\\1)/' | tee /etc/rc.conf > /dev/null"
|
||||||
echo "rm -f /etc/rc.conf.cdist-backup"
|
|
||||||
;;
|
;;
|
||||||
debian|ubuntu)
|
debian|ubuntu)
|
||||||
echo update-rc.d -f \"$name\" remove
|
echo update-rc.d -f \"$name\" remove
|
||||||
|
|
Loading…
Reference in a new issue