bin/homedir-setup

Thu, 09 Feb 2017 19:00:50 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Thu, 09 Feb 2017 19:00:50 -0500
changeset 509
14ac01e21c51
parent 486
608ad4499439
child 534
6a8fc81c470c
permissions
-rwxr-xr-x

in-place write for crontabs

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
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
4 if [ ! -f .zshrc ]; then
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
5 echo "Refusing to run without a .zshrc nearby" >&2
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
6 exit 1
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
7 fi
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
8
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 if ! git --version >/dev/null; then
285
fefaa23c064c Add check for .zshrc
Meredith Howard <mhoward@roomag.org>
parents: 275
diff changeset
10 echo "Please install git!" >&2
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 exit 1
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
14 pull() {
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 echo "$1:"
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
16 git -C "$1" pull --no-tags
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 }
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 if ! [ -d .zgen ]; then
482
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
20 git clone --depth 1 'https://github.com/tarjoilija/zgen.git' .zgen
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 else
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 pull .zgen
486
608ad4499439 zgen update too
Meredith Howard <mhoward@roomag.org>
parents: 482
diff changeset
23 zsh -i -c 'zgen update'
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 if ! [ -d .plenv ]; then
482
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
27 git clone --depth 1 'https://github.com/tokuhirom/plenv.git' .plenv
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
28 git clone --depth 1 'https://github.com/tokuhirom/Perl-Build.git' .plenv/plugins/perl-build/
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 else
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 pull .plenv
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 pull .plenv/plugins/perl-build
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
34 if ! [ -d .asdf ]; then
482
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
35 git clone --depth 1 'https://github.com/asdf-vm/asdf' .asdf
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 else
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
37 pull .asdf
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
38 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
40 for LANG in ruby nodejs erlang elixir; do
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
41 if ! [ -d .asdf/plugins/$LANG ]; then
482
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
42 git clone --depth 1 "https://github.com/asdf-vm/asdf-$LANG" .asdf/plugins/$LANG
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
43 else
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
44 pull .asdf/plugins/$LANG
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
45 fi
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
46 done
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
47
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
48 # Get rid of older stuff
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
49 if [ -d .rbenv ]; then
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
50 echo 'rbenv is still installed' >&2
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
51 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
52
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
53 if [ -d .ndenv ]; then
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
54 echo 'ndenv is still installed' >&2
328
b3b18ced6949 add asdf-vm
Meredith Howard <mhoward@roomag.org>
parents: 285
diff changeset
55 fi

mercurial