Last active
December 12, 2015 10:39
-
-
Save ksinkar/4760796 to your computer and use it in GitHub Desktop.
This script is simple way of configuring an rvm multiuser installation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright(C) 2012 Koustubh Sinkar | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/ | |
usage="\nUSAGE:\t\t ./rvm_global_install.sh [options]\n\nDESCRIPTION:\t This script is for creating the default RVM setup preferred by Koustubh Sinkar on any *nix computer that he setups\n\nOPTIONS:\n\t -x\t\t executes the installation script\n\t -h \t\t displays this help" | |
while getopts "xh" opt; do | |
case $opt in | |
x) | |
user=`whoami` | |
if [ $user != 'root' ]; then | |
echo -e "You are not root/su. Please login again as root and rerun the script or run the script using sudo.\n" | |
exit | |
fi | |
echo "Creating the system rvmuser who will responsible for managing the global rvm installlation" | |
useradd --system --base-dir /var/lib --create-home --no-user-group rvmuser | |
echo "Please set the password for the rvmuser." | |
passwd rvmuser | |
echo "Adding the rvmuser to the sudo group" | |
adduser rvmuser sudo | |
# Install the Multi User installation | |
su - rvmuser --command "cd ~; \curl -L https://get.rvm.io | sudo bash -s stable" | |
echo "Adding the rvmuser to the group rvm" | |
adduser rvmuser rvm | |
exit | |
;; | |
h) | |
echo -e $usage | |
exit | |
;; | |
*) | |
echo -e $usage | |
exit | |
;; | |
esac | |
done | |
echo -e $usage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment