Created
July 31, 2017 15:10
-
-
Save fuzzy/a07724f279550cbb5d8bcb72745ff870 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
LOCAL_BASE=${HOME}/.local | |
test ! -d ${LOCAL_BASE} && mkdir -p ${LOCAL_BASE} | |
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
####################### | |
### Ssh-agent setup ### | |
####################### | |
refresh_ssh_agent_env() { | |
ssh-agent -s > ${HOME}/.sshenv | |
. ${HOME}/.sshenv | |
ssh-add | |
} | |
# Source in, or setup ssh-agent info | |
if test -e ${HOME}/.sshenv; then | |
. ${HOME}/.sshenv | |
else | |
refresh_ssh_agent_env | |
fi | |
proc_sshagent=$(ps aux|grep ${SSH_AGENT_PID}|grep -v grep) | |
# Start a new ssh-agent if the old one isn't running | |
test -z "${proc_sshagent}" && refresh_ssh_agent_env | |
unset -v proc_sshagent | |
unset -f refresh_ssh_agent_env | |
################### | |
### Sshfs setup ### | |
################### | |
mount_corputil_sshfs=$(df -h|grep corputil|grep -v grep) | |
# mount corputil via sshfs if it's not mounted | |
test -z "${mount_corputil_sshfs}" && sshfs fuzzy.partin@corputil02:wd ${HOME}/corputil | |
unset -v mount_corputil_sshfs | |
#################### | |
### Golang setup ### | |
#################### | |
GOLANG_STRP_VERS=1.4.3 | |
GOLANG_PROD_VERS=1.8.3 | |
GOLANG_SRC_URI=https://storage.googleapis.com/golang/go | |
GOLANG_INST_DIR=${LOCAL_BASE}/go | |
GOLANG_INST_ROOT=${GOLANG_INST_DIR}/go${GOLANG_PROD_VERS} | |
GOLANG_INST_PATH=${GOLANG_INST_DIR}/path | |
GOLANG_INST_STRP=${GOLANG_INST_DIR}/strap | |
golang_get_uri() { | |
test ! -z "${1}" && echo ${GOLANG_SRC_URI}${1}.src.tar.gz | |
} | |
for path in ${GOLANG_INST_DIR} ${GOLANG_INST_PATH}; do | |
test ! -d ${path} && mkdir -p ${path} | |
done | |
if test ! -x ${GOLANG_INST_STRP}/bin/go; then | |
cd ${GOLANG_INST_DIR} | |
test -d ${GOLANG_INST_STRP} && rm -rf ${GOLANG_INST_STRP} | |
curl $(golang_get_uri ${GOLANG_STRP_VERS}) | tar -zxf- && mv go ${GOLANG_INST_STRP} | |
cd ${GOLANG_INST_STRP}/src && ./make.bash | |
fi | |
if test ! -x ${GOLANG_INST_ROOT}/bin/go || test "$(${GOLANG_INST_ROOT}/bin/go version|awk '{print $3}'|tr -d go)" != "${GOLANG_PROD_VERS}"; then | |
cd ${GOLANG_INST_DIR} | |
test -d ${GOLANG_INST_ROOT} && rm -rf ${GOLANG_INST_ROOT} | |
curl $(golang_get_uri ${GOLANG_PROD_VERS}) | tar -zxf- && mv go ${GOLANG_INST_ROOT} | |
cd ${GOLANG_INST_ROOT}/src && env GOROOT_BOOTSTRAP=${GOLANG_INST_STRP} ./make.bash | |
fi | |
export GOROOT=${GOLANG_INST_ROOT} | |
export GOPATH=${GOLANG_INST_PATH} | |
export PATH=${GOROOT}/bin:${GOPATH}/bin:${PATH} | |
unset -v GOLANG_STRP_VERS GOLANG_PROD_VERS GOLANG_SRC_URI GOLANG_INST_DIR GOLANG_INST_ROOT GOLANG_INST_PATH GOLANG_INST_STRP | |
unset -f golang_get_uri | |
#################### | |
### Python setup ### | |
#################### | |
PY_VERS=2.7.13 | |
PY_ROOT=${LOCAL_BASE}/py${PY_VERS} | |
test ! -d ${PY_ROOT} && mkdir -p ${PY_ROOT} | |
if test ! -x ${PY_ROOT}/bin/python2; then | |
cd /tmp | |
curl https://www.python.org/ftp/python/${PY_VERS}/Python-${PY_VERS}.tar.xz | tar -Jxf- | |
cd Python-${PY_VERS} | |
./configure --with-signal-module --with-threads --prefix=${PY_ROOT} --with-pth --with-fpectl --with-ensurepip=upgrade | |
make -j8 && make install | |
cd /tmp && rm -rf Python-${PY_VERS} | |
fi | |
export PATH=${PY_ROOT}/bin:${PATH} | |
unset -v PY_VERS PY_ROOT | |
################## | |
### Ruby setup ### | |
################## | |
RB_VERS=2.4.1 | |
RB_ROOT=${LOCAL_BASE}/rb${RB_VERS} | |
test ! -d ${RB_ROOT} && mkdir -p ${RB_ROOT} | |
if test ! -x ${RB_ROOT}/bin/ruby; then | |
cd /tmp | |
curl https://cache.ruby-lang.org/pub/ruby/2.4/ruby-${RB_VERS}.tar.gz | tar -zxf- | |
cd ruby-${RB_VERS} && ./configure --prefix=${RB_ROOT} --enable-pthread --disable-install-doc | |
make -j8 && make install | |
cd /tmp && rm -rf ruby-${RB_VERS} | |
fi | |
export PATH=${RB_ROOT}/bin:${PATH} | |
unset -v RB_VERS RB_ROOT | |
################### | |
### And finally ### | |
################### | |
cd ${HOME} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment