~charles/dotfiles

dotfiles/utils/install.sh -rwxr-xr-x 726 bytes
171c95a2Charles Daniels ztag: include tags in output 17 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

# Install utilities. Expects BIN_DIR to be set as the destination for utilities
# to be installed.
#
# Each utilities folder (peers with this script) should have a top-level
# install.sh script, which will be called with BIN_DIR set. Each directory MAY
# have a top-level test.sh script, which will run tests for the utility.
#
# If TEST is set, then tests will be run rather than performing the install.

set -e
set -u

cd "$(dirname "$0")"

for d in ./* ; do
	if [ ! -d "$d" ] ; then
		continue
	fi

	if [ ! -e "$d/install.sh" ] ; then
		continue
	fi

	set +u
	if [ ! -z "$TEST" ] ; then
		if [ -e "$d/test.sh" ] ; then
			sh "$d/test.sh"
		fi
		continue
	fi
	set +u

	BIN_DIR="$BIN_DIR" sh "$d/install.sh"
done