bin/homedir-setup

Sun, 09 Jan 2022 15:17:13 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 09 Jan 2022 15:17:13 -0500
changeset 968
0db164e368c5
parent 967
9314317ed18f
child 969
28111ba4e573
permissions
-rwxr-xr-x

keep shell stuff in one place, distinguish by ext

964
72a7a0ffbce8 retire plenv for asdf
Meredith Howard <mhoward@roomag.org>
parents: 850
diff changeset
1 #!/bin/bash
72a7a0ffbce8 retire plenv for asdf
Meredith Howard <mhoward@roomag.org>
parents: 850
diff changeset
2 set -euo pipefail
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
967
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
4 warn() { echo "$*" >&2; }
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
5 die() { warn "$*"; exit 1; }
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
7 clone_or_pull() {
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
8 if ! [ -d $2 ]; then
966
e1132c1cce12 use clone --single-branch
Meredith Howard <mhoward@roomag.org>
parents: 965
diff changeset
9 git clone --single-branch --depth 1 "$1" $2
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
10 else
850
Meredith Howard <mhoward@roomag.org>
parents: 849
diff changeset
11 echo "$2:"
966
e1132c1cce12 use clone --single-branch
Meredith Howard <mhoward@roomag.org>
parents: 965
diff changeset
12 git -C "$2" pull
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
13 fi
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 }
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15
967
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
16 [ -f .zshrc ] ||
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
17 die "Refusing to run without a .zshrc nearby"
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
18
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
19 git --version >/dev/null ||
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
20 die "Please install git!"
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
21
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
22 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
23
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
24 zsh -i -c 'zgen update' || :
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25
965
f1e5d30543ba forget the minimal setup mode
Meredith Howard <mhoward@roomag.org>
parents: 964
diff changeset
26 clone_or_pull 'https://github.com/asdf-vm/asdf' .asdf
f1e5d30543ba forget the minimal setup mode
Meredith Howard <mhoward@roomag.org>
parents: 964
diff changeset
27 source .asdf/asdf.sh
245
9fa186a70bbd add .homedir-setup.sh
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28
965
f1e5d30543ba forget the minimal setup mode
Meredith Howard <mhoward@roomag.org>
parents: 964
diff changeset
29 asdf plugin add perl || :
f1e5d30543ba forget the minimal setup mode
Meredith Howard <mhoward@roomag.org>
parents: 964
diff changeset
30 asdf plugin update --all
756
8bc91181db9d add setup-man
Meredith Howard <mhoward@roomag.org>
parents: 534
diff changeset
31
965
f1e5d30543ba forget the minimal setup mode
Meredith Howard <mhoward@roomag.org>
parents: 964
diff changeset
32 bin/setup-man || :
381
b09db2db7f84 use ruby and nodejs plugins for asdf
Meredith Howard <mhoward@roomag.org>
parents: 328
diff changeset
33
459
efa21f0b1dca Remove rbenv & ndenv transition stuff
Meredith Howard <mhoward@roomag.org>
parents: 383
diff changeset
34 # Get rid of older stuff
964
72a7a0ffbce8 retire plenv for asdf
Meredith Howard <mhoward@roomag.org>
parents: 850
diff changeset
35 for OLD in .plenv .rbenv .ndenv; do
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
36 if [ -e $OLD ]; then
967
9314317ed18f clean up
Meredith Howard <mhoward@roomag.org>
parents: 966
diff changeset
37 warn "Pruning $OLD"
849
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
38 rm -rf $OLD
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
39 fi
9a6cb845e239 Switch to perl-install and simplify clone or pull
Meredith Howard <mhoward@roomag.org>
parents: 760
diff changeset
40 done

mercurial