bin/homedir-setup

Mon, 17 Jun 2019 18:45:19 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 17 Jun 2019 18:45:19 -0500
changeset 772
7ae185f81e1a
parent 760
d439bf421f1b
child 849
9a6cb845e239
permissions
-rwxr-xr-x

allow switching base mod key

#!/bin/sh
set -eu

minimal=0

case ${1:-} in -m) minimal=1;;
esac

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 --depth 1 'https://github.com/tarjoilija/zgen.git' .zgen
else
  pull .zgen
  zsh -i -c 'zgen update' || true
fi

if [ "$minimal" -ne 1 ]; then
  if ! [ -d .plenv ]; then
    git clone --depth 1 'https://github.com/tokuhirom/plenv.git' .plenv
    git clone --depth 1 '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 --depth 1 'https://github.com/asdf-vm/asdf' .asdf
  else
    pull .asdf
  fi

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

  bin/setup-man || true
fi

# Get rid of older stuff
if [ -d .rbenv ]; then
  echo 'rbenv is still installed' >&2
fi

if [ -d .ndenv ]; then
  echo 'ndenv is still installed' >&2
fi

mercurial