bin/homedir-setup

Sun, 24 May 2020 00:47:43 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 24 May 2020 00:47:43 -0500
changeset 867
118c469a1c85
parent 850
5ebdbddeafde
child 964
72a7a0ffbce8
permissions
-rwxr-xr-x

housekeeping ftplugins

245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 #!/bin/sh
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 set -eu
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
4 minimal=0
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
5
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
6 case ${1:-} in -m) minimal=1;;
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
7 esac
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
8
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
9 if [ ! -f .zshrc ]; then
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
10 echo "Refusing to run without a .zshrc nearby" >&2
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
11 exit 1
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
12 fi
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
13
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 if ! git --version >/dev/null; then
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
15 echo "Please install git!" >&2
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 exit 1
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
19 clone_or_pull() {
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
20 if ! [ -d $2 ]; then
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
21 git clone --depth 1 "$1" $2
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
22 else
850
Meredith Howard <mhoward@roomag.org>
parents: 849
diff changeset
23 echo "$2:"
Meredith Howard <mhoward@roomag.org>
parents: 849
diff changeset
24 git -C "$2" pull --no-tags
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
25 fi
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 }
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
28 clone_or_pull 'https://github.com/tarjoilija/zgen.git' .zgen
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
29
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
30 zsh -i -c 'zgen update' || :
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
32 if [ "$minimal" -ne 1 ]; then
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
33 clone_or_pull 'https://github.com/tokuhirom/plenv.git' .plenv
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
34 clone_or_pull 'https://github.com/skaji/perl-install' .plenv/plugins/perl-install
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
36 clone_or_pull 'https://github.com/asdf-vm/asdf' .asdf
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
37
758
949b2d4df5fd whoops, LANG confuses things later
Meredith Howard <mhoward@roomag.org>
parents: 756
diff changeset
38 for PLUGIN in ruby nodejs erlang elixir; do
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
39 clone_or_pull "https://github.com/asdf-vm/asdf-$PLUGIN" .asdf/plugins/$PLUGIN
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
40 done
756
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents: 534
diff changeset
41
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
42 bin/setup-man || :
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
43 fi
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
44
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
45 # Get rid of older stuff
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
46 for OLD in .plenv/plugins/perl-build .rbenv .ndenv; do
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
47 if [ -e $OLD ]; then
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
48 echo "Pruning $OLD" >&2
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
49 rm -rf $OLD
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
50 fi
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
51 done

mercurial