Sha256: 1c7f913087b57814678995d570e1a7d0c6ce8a86a2c9028fe4f1a675a0b35ad0

Contents?: true

Size: 997 Bytes

Versions: 26

Compression:

Stored size: 997 Bytes

Contents

#!/bin/bash --login
# USE THIS SCRIPT WHEN UPGRADING RUBY
if [[ -d '/opt/pwn' ]]; then
  pwn_root='/opt/pwn' 
else
  pwn_root="${PWN_ROOT}"
fi

function usage() {
  echo $"Usage: $0 <new ruby version e.g. 2.4.4> <optional bool running from build_pwn_gem.sh>"
  exit 1
}

source /etc/profile.d/rvm.sh

new_ruby_version=$1
if [[ $2 != '' ]]; then
  old_ruby_version=$2
else
  old_ruby_version=`cat ${pwn_root}/.ruby-version`
fi

ruby_gemset=`cat ${pwn_root}/.ruby-gemset`

if [[ $# < 1 ]]; then
  usage
fi

# Upgrade RVM
curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg2 --import -
export rvmsudo_secure_path=1
rvmsudo rvm get latest
rvm reload

# Install New Version of RubyGems & Ruby
cd $pwn_root && ./vagrant/provisioners/gem.sh
rvmsudo rvm install ruby-$new_ruby_version
echo $new_ruby_version > $pwn_root/.ruby-version

cd / && cd $pwn_root && rvm use $new_ruby_version@$ruby_gemset && ./build_pwn_gem.sh
rvmsudo gem pristine --all

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
pwn-0.4.584 upgrade_ruby.sh
pwn-0.4.583 upgrade_ruby.sh
pwn-0.4.582 upgrade_ruby.sh
pwn-0.4.581 upgrade_ruby.sh
pwn-0.4.580 upgrade_ruby.sh
pwn-0.4.579 upgrade_ruby.sh