support root and user rvm
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								07902f2a0b
							
						
					
				
			
			
				commit
				
					
						62c69c63b5
					
				
			
		
					 1 changed files with 13 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue