bin/homedir-setup

Thu, 06 Jun 2019 13:35:16 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Thu, 06 Jun 2019 13:35:16 -0500
changeset 770
1b9258b32ca4
parent 760
d439bf421f1b
child 849
9a6cb845e239
permissions
-rwxr-xr-x

Go back to viewdoc default maps

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
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
19 pull() {
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 echo "$1:"
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
21 git -C "$1" pull --no-tags
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 }
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 if ! [ -d .zgen ]; then
482
2c7cb331d2dc Don't really need full clones
Meredith Howard <mhoward@roomag.org>
parents: 461
diff changeset
25 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
26 else
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 pull .zgen
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
28 zsh -i -c 'zgen update' || true
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
31 if [ "$minimal" -ne 1 ]; then
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
32 if ! [ -d .plenv ]; then
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
33 git clone --depth 1 'https://github.com/tokuhirom/plenv.git' .plenv
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
34 git clone --depth 1 'https://github.com/tokuhirom/Perl-Build.git' .plenv/plugins/perl-build/
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
35 else
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
36 pull .plenv
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
37 pull .plenv/plugins/perl-build
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
38 fi
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
40 if ! [ -d .asdf ]; then
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
41 git clone --depth 1 'https://github.com/asdf-vm/asdf' .asdf
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
42 else
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
43 pull .asdf
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
44 fi
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
45
758
949b2d4df5fd whoops, LANG confuses things later
Meredith Howard <mhoward@roomag.org>
parents: 756
diff changeset
46 for PLUGIN in ruby nodejs erlang elixir; do
949b2d4df5fd whoops, LANG confuses things later
Meredith Howard <mhoward@roomag.org>
parents: 756
diff changeset
47 if ! [ -d .asdf/plugins/$PLUGIN ]; then
760
Meredith Howard <mhoward@roomag.org>
parents: 758
diff changeset
48 git clone --depth 1 "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
49 else
758
949b2d4df5fd whoops, LANG confuses things later
Meredith Howard <mhoward@roomag.org>
parents: 756
diff changeset
50 pull .asdf/plugins/$PLUGIN
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
51 fi
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
52 done
756
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents: 534
diff changeset
53
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents: 534
diff changeset
54 bin/setup-man || true
534
6a8fc81c470c Add -m minimal option to skip extras
Meredith Howard <mhoward@roomag.org>
parents: 486
diff changeset
55 fi
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
56
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
57 # Get rid of older stuff
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
58 if [ -d .rbenv ]; then
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
59 echo 'rbenv is still installed' >&2
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
60 fi
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
61
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
62 if [ -d .ndenv ]; then
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
63 echo 'ndenv is still installed' >&2
328
b3b18ced6949 add asdf-vm
Meredith Howard <mhoward@roomag.org>
parents: 285
diff changeset
64 fi

mercurial