diff --git a/install b/install index 04f79eb7f..1aad6dbbb 100755 --- a/install +++ b/install @@ -50,7 +50,7 @@ check_os() { install_mac elif [ "${OS}" = "FreeBSD" ]; then info "Launching FreeBSD install..." - for SUFX in 26 25 24 23; do + for SUFX in 32 31 30; do if command_exists ruby${SUFX}; then RUBYSUFFIX=${SUFX} break @@ -59,7 +59,7 @@ check_os() { install_freebsd elif [ "${OS}" = "OpenBSD" ]; then info "Launching OpenBSD install..." - for SUFX in 26 25 24 23; do + for SUFX in 32 31 30; do if command_exists ruby${SUFX}; then RUBYSUFFIX=${SUFX} break @@ -67,7 +67,7 @@ check_os() { done install_openbsd else - fatal "Unable to locate installer for your Operating system: $OS" + fatal "Unable to locate installer for your operating system: ${OS}" fi } @@ -86,14 +86,14 @@ install_linux() { Distro='Alpine' elif [ -f /etc/os-release ]; then #DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2-) - DISTRO_ID=$(cat /etc/os-release | grep ID= | grep -v "BUILD" | grep -v "IMAGE" | cut -d= -f2-) + DISTRO_ID=$(grep ID= /etc/os-release | grep -v "BUILD" | grep -v "IMAGE" | cut -d= -f2-) if [ "${DISTRO_ID}" = 'kali' ]; then Distro='Kali' elif [ "${DISTRO_ID}" = 'arch' ] || [ "${DISTRO_ID}" = 'garuda' ] || [ "${DISTRO_ID}" = 'artix' ] || [ "${DISTRO_ID}" = 'manjaro' ] || [ "${DISTRO_ID}" = 'blackarch' ] || [ "${DISTRO_ID}" = 'arcolinux' ]; then Distro='Arch' - elif cat /etc/os-release | grep -Eqi '^ID.*suse'; then + elif grep -Eqi '^ID.*suse' /etc/os-release; then Distro='SuSE' - fi # Usually, I would do this very differently (. /etc/os-release ...), but keeping to the style. + fi fi if [ -z "${Distro}" ]; then @@ -105,7 +105,7 @@ install_linux() { 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 libcurl4-openssl-dev - if command_exists rvm || command_exists rbenv version; then + if command_exists rvm || command_exists rbenv; then info "Ruby package Manager exists - Ruby install skipped" else info "No Ruby package manager detected - will install Ruby" @@ -117,26 +117,29 @@ install_linux() { IFS=$NORMIFS intpkg="" nodejsver=nodejs16 - rpm --quiet -q nodejs18 && nodejsver="" # having NodeJS 18 installed should mean NodeJS 16 is not needed + + # having NodeJS 18 installed should mean NodeJS 16 is not needed + rpm --quiet -q nodejs18 && nodejsver="" + for i in git make gcc libopenssl-devel gcc-c++ patch libreadline6 readline6-devel libz1 zlib-devel libyaml-devel libffi-devel bzip2 autoconf automake libtool bison sqlite3-devel $nodejsver; do - rpm --quiet -q $i || intpkg="$intpkg $i" + rpm --quiet -q "${i}" || intpkg="${intpkg} ${i}" done - [ "$intpkg" ] && sudo zypper -n install -l $intpkg + [ "$intpkg" ] && sudo zypper -n install -l "${intpkg}" IFS=$SCRIFS elif [ "${Distro}" = "blackPanther" ]; then installing --auto git make gcc openssl-devel gcc-c++ patch readline-devel zlib-devel yaml-devel libffi-devel bzip2 autoconf automake libtool bison sqlite-devel nodejs sudo 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 # Installs dependencies - if command_exists rvm || command_exists rbenv version; then + sudo pacman -Syu + sudo pacman -S curl git make openssl gcc readline zlib libyaml sqlite bzip2 autoconf automake libtool bison nodejs + if command_exists rvm || command_exists rbenv; 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 + apk update + 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 fi } @@ -180,17 +183,17 @@ check_ruby_version() { info 'Detecting Ruby environment...' - MIN_RUBY_VER='2.5' + MIN_RUBY_VER='3.0' 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 + info "Ruby version ${RUBY_VERSION} is installed with RVM" + if RUBY_VERSION -lt 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 + elif command_exists rbenv; then RUBY_VERSION=$(rbenv version | cut -d' ' -f 2) - info "Ruby version ${RUBY_VERSION} is installed" - if RUBY_VERSION -le MIN_RUBY_VER; then + info "Ruby version ${RUBY_VERSION} is installed with rbenv" + if RUBY_VERSION -lt 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 @@ -204,15 +207,6 @@ check_ruby_version() { fi } -check_rubygems() { - if command_exists gem${RUBYSUFFIX}; then - info 'Updating rubygems...' - if ! sudo gem${RUBYSUFFIX} update --system; then - warn "Updating rubygems failed" - fi - fi -} - check_bundler() { info 'Detecting bundler gem...' @@ -221,7 +215,7 @@ check_bundler() { info "bundler${RUBYSUFFIX} gem is installed" else info 'Installing bundler gem...' - sudo gem${RUBYSUFFIX} install bundler + gem${RUBYSUFFIX} install bundler fi } @@ -233,7 +227,7 @@ install_beef() { /bin/rm Gemfile.lock fi - if command_exists bundler${RUBYSUFFIX}; then + if command_exists bundle${RUBYSUFFIX}; then bundle${RUBYSUFFIX} install else bundle install @@ -279,7 +273,6 @@ main() { fi check_os check_ruby_version - check_rubygems check_bundler install_beef finish