bin/homedir-setup

Mon, 09 Mar 2020 14:07:18 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 09 Mar 2020 14:07:18 -0500
changeset 849
9a6cb845e239
parent 760
d439bf421f1b
child 850
5ebdbddeafde
permissions
-rwxr-xr-x

Switch to perl-install and simplify clone or pull

#!/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

clone_or_pull() {
  if ! [ -d $2 ]; then
    git clone --depth 1 "$1" $2
  else
    echo "$1:"
    git -C "$1" pull --no-tags
  fi
}

clone_or_pull 'https://github.com/tarjoilija/zgen.git' .zgen

zsh -i -c 'zgen update' || :

if [ "$minimal" -ne 1 ]; then
  clone_or_pull 'https://github.com/tokuhirom/plenv.git' .plenv
  clone_or_pull 'https://github.com/skaji/perl-install'  .plenv/plugins/perl-install

  clone_or_pull 'https://github.com/asdf-vm/asdf' .asdf

  for PLUGIN in ruby nodejs erlang elixir; do
    clone_or_pull "https://github.com/asdf-vm/asdf-$PLUGIN" .asdf/plugins/$PLUGIN
  done

  bin/setup-man || :
fi

# Get rid of older stuff
for OLD in .plenv/plugins/perl-build .rbenv .ndenv; do
  if [ -e $OLD ]; then
    echo "Pruning $OLD" >&2
    rm -rf $OLD
  fi
done

mercurial