.lib/sh/util.sh

Fri, 09 Sep 2022 12:30:42 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 09 Sep 2022 12:30:42 -0400
changeset 1002
8284b9cac608
parent 969
28111ba4e573
permissions
-rw-r--r--

Add age limit reinstall check

969
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 warn() { echo "$*" >&2; }
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 die() { warn "$*"; exit 1; }
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 clone_or_pull() {
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 if ! [ -d $2 ]; then
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 git clone --single-branch --depth 1 "$1" $2
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 else
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 echo "$2:"
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 git -C "$2" pull
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 fi
28111ba4e573 move to util lib
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 }

mercurial