-
-
Save cghiban/d1d7094455286745a68445519bea2278 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
perl_version='5.25.6' | |
perl_version='5.24.0' | |
verify_pkg() { | |
pkg="$1" | |
[[ $(which "${pkg}") ]] || { | |
echo "${pkg} not found. Exiting..." | |
exit 1 | |
} | |
} | |
verify_pkg gcc | |
verify_pkg git | |
verify_pkg curl | |
[[ ! -f "$HOME/.plenv/README.md" ]] && { | |
git clone git://github.com/tokuhirom/plenv.git ~/.plenv | |
} || { | |
echo "****** plenv already installed" | |
} | |
bashrc_plenv[0]='export PATH="$HOME/.plenv/bin:$PATH"' | |
bashrc_plenv[1]='eval "$(plenv init -)"' | |
cx=0 | |
changed=0 | |
for content in "${bashrc_plenv[@]}"; do | |
[[ $(grep "${content}" "${HOME}/.bashrc") ]] && { | |
echo "****** ${cx}: .bashrc already updated." | |
} || { | |
echo "****** ${cx}: not in bashrc yet" | |
echo "${content}" >> "${HOME}/.bashrc" | |
changed=1 | |
} | |
cx=$((cx+1)) | |
done | |
[[ ! -f "$HOME/.plenv/plugins/perl-build/README.md" ]] && { | |
git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/ | |
} || { | |
echo "****** perl-build already installed into plenv" | |
} | |
#[[ $changed == 1 ]] && { | |
# echo "Restart your shell as a login shell so the path changes take effect. You can now begin using plenv." | |
# echo | |
# echo " you can manually run:" | |
# echo " exec $SHELL -l" | |
# echo | |
# echo "To initialize perl and cpanminus, e.g.:" | |
# echo "plenv install 5.24.0" | |
# echo "plenv global 5.24.0" | |
# echo "plenv install-cpanm" | |
#} | |
[[ $changed == 1 ]] && { | |
exec $SHELL -l | |
} | |
plenv_global_ver=$(plenv global) | |
[[ $plenv_global_ver == "${perl_version}" ]] && { | |
echo "****** Perl ${perl_version} already installed" | |
} || { | |
echo "****** Installing perl ${perl_version}" | |
plenv install "${perl_version}" | |
echo "****** Making perl ${perl_version} global" | |
plenv global "${perl_version}" | |
} | |
[[ $(which cpanm) ]] && { | |
echo "****** cpanm already installed into perl ${perl_version}" | |
} || { | |
echo "****** Installing cpanm into perl ${perl_version}" | |
plenv install-cpanm | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment