bin/homedir-setup

Fri, 18 Nov 2016 17:35:46 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 18 Nov 2016 17:35:46 -0500
changeset 434
be837354e11b
parent 383
c14c440cda0f
child 459
efa21f0b1dca
permissions
-rwxr-xr-x

simplify mail autoinsert, disable cursor autojump for mail

#!/bin/sh
set -eu

if [ ! -f .zshrc ]; then
  echo "Refusing to run without a .zshrc nearby" >&2
  exit 1
fi

if ! git --version >/dev/null; then
  echo "Please install git!" >&2
  exit 1
fi

pull () {
  echo "$1:"
  git -C $1 pull --no-tags
}

if ! [ -d .zgen ]; then
  git clone https://github.com/tarjoilija/zgen.git .zgen
else
  pull .zgen
fi

if ! [ -d .plenv ]; then
  git clone https://github.com/tokuhirom/plenv.git .plenv
  git clone https://github.com/tokuhirom/Perl-Build.git .plenv/plugins/perl-build/
else
  pull .plenv
  pull .plenv/plugins/perl-build
fi

if ! [ -d .asdf ]; then
  git clone https://github.com/asdf-vm/asdf .asdf
else
  pull .asdf
fi

for LANG in ruby nodejs erlang elixir; do
  if ! [ -d .asdf/plugins/$LANG ]; then
    git clone https://github.com/asdf-vm/asdf-$LANG .asdf/plugins/$LANG
  else
    pull .asdf/plugins/$LANG
  fi
done

# Transition older stuff to asdf
if [ -d .rbenv ]; then
  echo 'Removing rbenv and moving ruby installs'
  echo 'bin/* in each version dir needs all shebang lines fixed'

  if [ -d .rbenv/versions ]; then
    mkdir -p .asdf/installs
    mv .rbenv/versions .asdf/installs/ruby
    for ver in .asdf/installs/ruby/*; do
      bash -c "asdf reshim ruby $(basename $ver)"
    done
  fi

  if [ -f .rbenv/version ]; then
    echo "ruby $(cat .rbenv/version)" >> .tool-versions
  fi

  rm -rf .rbenv
fi

if [ -d .ndenv ]; then
  echo 'Removing ndenv and moving node installs'

  if [ -d .ndenv/versions ]; then
    mkdir -p .asdf/installs
    mv .ndenv/versions .asdf/installs/nodejs
    for ver in .asdf/installs/nodejs/*; do
      bash -c "asdf reshim nodejs $(basename $ver)"
    done
  fi

  if [ -f .ndenv/version ]; then
    echo "nodejs $(cat .ndenv/version)" >> .tool-versions
  fi

  rm -rf .ndenv
fi

mercurial