Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warn user that installation with --system flag will fail if she's not root #464 #465

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions share/ruby-install/ruby-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ function parse_ruby()
fi
}

#
#Called when selecting --system flag
#
function ensure_is_sudo() {
local warn_c="\e[1;33;1m" #set color
local reset_c="\e[0m" #unset color
if [[ UID != 0 ]]
then
echo -e "${warn_c}you may need permissions before proceeding${reset_c}"
exit
fi
}


#
# Parses command-line options for ruby-install.
#
Expand All @@ -123,6 +137,7 @@ function parse_options()
shift 2
;;
--system)
ensure_is_sudo
install_dir="$system_dir"
shift 1
;;
Expand Down