Skip to content

Instantly share code, notes, and snippets.

@ksinkar
Created February 12, 2013 11:33
Show Gist options
  • Save ksinkar/4761719 to your computer and use it in GitHub Desktop.
Save ksinkar/4761719 to your computer and use it in GitHub Desktop.
This shell script uninstalls rvm that has been install for multiuser installations using the installation script https://gist.github.com/ksinkar/4760796
#!/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_uninstall.sh [options]\n\nDESCRIPTION:\t This script is for removing the default RVM setup preferred by Koustubh Sinkar on any *nix computer that he has setup\n\nOPTIONS:\n\t -x\t executes the installation script\n\t -h \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 "Deleting the rvm installation files"
rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
echo "Deleting group rvm"
groupdel rvm
echo "Deleting the user rvmuser who was the manager of the global rvm installation"
userdel --remove rvmuser
echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete
or comment out if this was a Per-User installation."
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