-
-
Save IdoBar/8696b21c589b4016872f3da41ac8dace to your computer and use it in GitHub Desktop.
Set up plenv, install perl, cpanm, carton, set up environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile or .profile | |
# from https://github.com/tokuhirom/plenv#readme | |
MY_PROFILE_FILE="$HOME/.profile" | |
if [[ -n "$PERL_MB_OPT" ]]; then | |
echo "You must unset your local::lib environment variables first" | |
echo "Edit your ~/.bash_profile or ~/.bashrc and remove any references" | |
echo "to local::lib or export PERL*..." | |
exit 1 | |
fi | |
APP_GIT=`which git 2> /dev/null` | |
test -x "$APP_GIT" || ( echo "You must have git installed, please install with 'sudo apt-get install git' (or ask your system admin to install) and re-run script" > /dev/stderr && exit 1 ) | |
echo " - Building perl environment -" | |
# get plenv latest | |
echo " + Cloning latest plenv..." | |
git clone git://github.com/tokuhirom/plenv.git ~/.plenv | |
echo " + Updating .bash_profile with plenv bin and perl binary shims..." | |
PLENV_PATH='export PATH="$HOME/.plenv/bin:$PATH"' | |
PLENV_INIT='eval "$(plenv init -)"' | |
echo $PLENV_PATH >> $MY_PROFILE_FILE # add plenv to path | |
echo $PLENV_INIT >> $MY_PROFILE_FILE # shims and autocomplete | |
# make the above available for the rest of this script | |
eval $PLENV_PATH | |
eval $PLENV_INIT | |
echo " + Cloning perl-build..." | |
git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/ | |
LATEST_PERL=`plenv install -l | tail -n1` | |
plenv install -l | |
read -e -p "Select perl version to install (press enter for the latest, or replace it from the list above): " -i "$LATEST_PERL" PLENV_PERL_VERSION | |
# To install the latest version uncomment the line below | |
# PLENV_PERL_VERSION=`plenv install -l | tail -n1` | |
echo " + Building perl ${PLENV_PERL_VERSION} (with threading support)..." | |
plenv install $PLENV_PERL_VERSION -Dusethreads | |
echo " + Switching to $PLENV_PERL_VERSION" | |
plenv global $PLENV_PERL_VERSION | |
echo " + Installing cpanminus..." | |
plenv install-cpanm | |
echo " + Installing carton..." | |
cpanm Carton | |
echo "plenv installation complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let the user choose version (with the latest available one as default)