Merge pull request #51 from pestaa/master

Fix sed for FreeBSD
This commit is contained in:
Nico Schottelius 2012-04-27 02:34:58 -07:00
commit c24788a452
3 changed files with 11 additions and 5 deletions

View file

@ -34,7 +34,8 @@ fi
case "$state_should" in case "$state_should" in
absent) absent)
# remove lines starting with key # remove lines starting with key
echo "sed -i '/^$key\($delimiter\+\)/d' \"$file\"" echo "sed '/^$key\($delimiter\+\)/d' \"$file\" > \"$file.cdist-tmp\""
echo "mv \"$file.cdist-tmp\" \"$file\""
;; ;;
present) present)
case "$state_is" in case "$state_is" in
@ -44,7 +45,8 @@ case "$state_should" in
;; ;;
wrongvalue) wrongvalue)
# change exisiting value # change exisiting value
echo "sed -i \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\"" echo "sed \"s|^$key\($delimiter\+\).*|$key\1$value|\" \"$file\" > \"$file.cdist-tmp\""
echo "mv \"$file.cdist-tmp\" \"$file\""
;; ;;
*) *)
echo "Unknown explorer state: $state_is" >&2 echo "Unknown explorer state: $state_is" >&2

View file

@ -32,7 +32,9 @@ DONE
removed) removed)
cat << DONE cat << DONE
su - $user -c "rm -Rf \"\\\$HOME/.rvm\"; su - $user -c "rm -Rf \"\\\$HOME/.rvm\";
sed -i '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\"" sed '/rvm\/scripts\/rvm/d' \"\\\$HOME/.bashrc\" > \"\\\$HOME/.bashrc.cdist-tmp\"
mv \"\\\$HOME/.bashrc.cdist-tmp\" \"\\\$HOME/.bashrc\""
DONE DONE
;; ;;
esac esac

View file

@ -32,7 +32,8 @@ case "$state_should" in
present) present)
case "$os" in case "$os" in
archlinux) archlinux)
echo "sed -i 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf" echo "sed 's/^\\(DAEMONS=.*\\))/\\1 $name)/' /etc/rc.conf > /etc/rc.conf.cdist-tmp"
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
;; ;;
debian|ubuntu) debian|ubuntu)
echo "update-rc.d \"$name\" defaults >/dev/null" echo "update-rc.d \"$name\" defaults >/dev/null"
@ -66,7 +67,8 @@ 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 /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)/' > /etc/rc.conf.cdist-tmp"
echo "mv /etc/rc.conf.cdist-tmp /etc/rc.conf"
;; ;;
debian|ubuntu) debian|ubuntu)
echo update-rc.d -f \"$name\" remove echo update-rc.d -f \"$name\" remove