escape user parameter in __rvm* types

This commit is contained in:
Evax Software 2012-01-18 14:52:46 +01:00
parent 72dea3d930
commit 65be80f2c6
8 changed files with 21 additions and 21 deletions

View file

@ -23,13 +23,13 @@ gemset="$(cat "$__object/parameter/gemset")"
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
user="$(cat "$__object/parameter/user")"
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
echo "removed"
exit 0
fi
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
rvm list | grep -q $ruby"; then
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname &&
rvm use $gemset > /dev/null && gem list | grep -q $gem"; then
echo "installed"

View file

@ -29,13 +29,13 @@ if [ "$state_is" != "$state_should" ]; then
case "$state_should" in
installed)
cat << DONE
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
rvm use $gemset; gem install $gem"
DONE
;;
removed)
cat << DONE
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
rvm use $gemset; gem uninstall $gem"
DONE
;;

View file

@ -31,8 +31,8 @@ else
echo $default > "$__object/parameter/default"
fi
__rvm $user --state installed
__rvm "$user" --state installed
require="__rvm/$user" \
__rvm_ruby $ruby --user $user --state installed --default $default
__rvm_ruby $ruby --user "$user" --state installed --default $default
require="__rvm_ruby/$ruby" \
__rvm_gemset $gemset --user $user --state installed --default $default
__rvm_gemset $gemset --user "$user" --state installed --default $default

View file

@ -22,13 +22,13 @@ gemset="$__object_id"
ruby="$(echo "$gemset" | cut -d '@' -f 1)"
gemsetname="$(echo "$gemset" | cut -d '@' -f2)"
user="$(cat "$__object/parameter/user")"
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
echo "removed"
exit 0
fi
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
rvm list | grep -q $ruby"; then
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
rvm use $ruby > /dev/null; rvm gemset list | grep -q $gemsetname"; then
echo "installed"
exit 0

View file

@ -28,7 +28,7 @@ if [ "$state_is" != "$state_should" ]; then
case "$state_should" in
installed)
cat << DONE
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
rvm $gemset --create"
DONE
case "$default" in
@ -36,7 +36,7 @@ DONE
;;
*)
cat << DONE
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
rvm use --default $gemset"
DONE
;;
@ -44,7 +44,7 @@ DONE
;;
removed)
cat << DONE
su - $user -c "source \"\\\$HOME/.rvm/scripts/rvm\"
su - "$user" -c "source \"\\\$HOME/.rvm/scripts/rvm\"
rvm use $ruby; rvm --force gemset delete $gemsetname"
DONE
;;

View file

@ -29,7 +29,7 @@ else
default="no"
fi
__rvm $user --state installed
__rvm "$user" --state installed
require="__rvm/$user" \
__rvm_ruby $ruby --user $user --state installed --default $default
__rvm_ruby $ruby --user "$user" --state installed --default $default

View file

@ -20,11 +20,11 @@
ruby="$__object_id"
user="$(cat "$__object/parameter/user")"
if su - $user -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
if su - "$user" -c "[ ! -d \"\$HOME/.rvm\" ]" ; then
echo "removed"
exit 0
fi
if su - $user -c "source \"\$HOME/.rvm/scripts/rvm\"
if su - "$user" -c "source \"\$HOME/.rvm/scripts/rvm\"
rvm list | grep -q $ruby"; then
echo "installed"
else

View file

@ -26,19 +26,19 @@ state_should="$(cat "$__object/parameter/state")"
if [ "$state_is" != "$state_should" ]; then
case "$state_should" in
installed)
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
"rvm install $ruby\""
case "$default" in
no)
;;
*)
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
"rvm use --default $ruby\""
;;
esac
;;
removed)
echo "su - $user -c \"source \\\$HOME/.rvm/scripts/rvm;"\
echo "su - \"$user\" -c \"source \\\$HOME/.rvm/scripts/rvm;"\
"rvm remove $ruby\""
;;
esac