From 62c69c63b51d23e6277bfda948efd36fc0a27aa6 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@brief.schottelius.org>
Date: Tue, 2 Oct 2012 18:05:47 +0200
Subject: [PATCH] support root and user rvm

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
---
 conf/type/__rvm/explorer/state | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/conf/type/__rvm/explorer/state b/conf/type/__rvm/explorer/state
index d0da0d86..f43f5509 100755
--- a/conf/type/__rvm/explorer/state
+++ b/conf/type/__rvm/explorer/state
@@ -19,8 +19,18 @@
 #
 
 user="$__object_id"
-if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
-   echo "present"
+
+# RVM behaves differently if root is the username / uid == 0
+if [ "$user" = "root" ]; then
+    if [ -d /usr/local/rvm ]; then
+        echo present
+    else
+        echo absent
+    fi
 else
-   echo "absent"
+    if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then
+       echo "present"
+    else
+       echo "absent"
+    fi
 fi