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

sudo for gem install, ruby package manager check #1940

Merged
merged 1 commit into from
Jul 5, 2020
Merged
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
38 changes: 33 additions & 5 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,24 @@ install_linux () {
info "Installing ${Distro} prerequisite packages..."
if [ "${Distro}" = "Debian" ] || [ "${Distro}" = "Kali" ]; then
sudo apt-get update
sudo apt-get install curl git build-essential openssl libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison nodejs ruby-dev libcurl4-openssl-dev
sudo apt-get install curl git build-essential openssl libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison nodejs libcurl4-openssl-dev gcc-9-base libgcc-9-dev
if command_exists rvm || command_exists rbenv version; then
info "Ruby package Manager exists - Ruby install skipped"
else
info "No Ruby package manager detected - will install Ruby"
sudo apt-get install ruby-dev
fi
elif [ "${Distro}" = "RedHat" ]; then
sudo yum install -y git make gcc openssl-devel gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel bzip2 autoconf automake libtool bison sqlite-devel nodejs
elif [ "${Distro}" = "Arch" ]; then
sudo pacman -Syu # Updates repo, dependencies, etc.
sudo pacman -S curl git make openssl gcc readline zlib libyaml sqlite bzip2 autoconf automake libtool bison nodejs ruby ruby-rdoc # Installs dependencies
sudo pacman -S curl git make openssl gcc readline zlib libyaml sqlite bzip2 autoconf automake libtool bison nodejs # Installs dependencies
if command_exists rvm || command_exists rbenv version; then
info "Ruby package Manager exists - Ruby install skipped"
else
info "No Ruby package manager detected - will install Ruby"
sudo pacman -S ruby ruby-rdoc
fi
elif [ "${Distro}" = "Alpine" ]; then
apk update # Updates repo, dependencies, etc.
apk add curl git build-base openssl readline-dev zlib zlib-dev libressl-dev yaml-dev sqlite-dev sqlite libxml2-dev libxslt-dev autoconf libc6-compat ncurses5 automake libtool bison nodejs # Installs dependencies
Expand Down Expand Up @@ -157,7 +169,23 @@ check_ruby_version () {
info 'Detecting Ruby environment...'

MIN_RUBY_VER='2.5'
if command_exists ruby${RUBYSUFFIX}
if command_exists rvm
then
RUBY_VERSION=$(rvm current | cut -d'-' -f 2)
info "Ruby version ${RUBY_VERSION} is installed"
if RUBY_VERSION -le MIN_RUBY_VER
then
fatal "Ruby version ${RUBY_VERSION} is not supported. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
elif command_exists rbenv version
then
RUBY_VERSION=$(rbenv version | cut -d' ' -f 2)
info "Ruby version ${RUBY_VERSION} is installed"
if RUBY_VERSION -le MIN_RUBY_VER
then
fatal "Ruby version ${RUBY_VERSION} is not supported. Please install Ruby ${MIN_RUBY_VER} (or newer) and restart the installer."
fi
elif command_exists ruby${RUBYSUFFIX}
then
RUBY_VERSION=$(ruby${RUBYSUFFIX} -e "puts RUBY_VERSION")
info "Ruby version ${RUBY_VERSION} is installed"
Expand All @@ -174,7 +202,7 @@ check_rubygems () {
if command_exists gem${RUBYSUFFIX}
then
info 'Updating rubygems...'
gem${RUBYSUFFIX} update --system
sudo gem${RUBYSUFFIX} update --system
fi
}

Expand All @@ -187,7 +215,7 @@ check_bundler () {
info "bundler${RUBYSUFFIX} gem is installed"
else
info 'Installing bundler gem...'
gem${RUBYSUFFIX} install bundler
sudo gem${RUBYSUFFIX} install bundler
fi
}

Expand Down