-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·62 lines (46 loc) · 1.12 KB
/
install.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# This script installs Bashsh.
: ${PREFIX:=/usr/local}
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# vvv PARTIAL COPY OF BASHSH-0 vvv
# http://misc.flogisoft.com/bash/tip_colors_and_formatting
# http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux#comment24883926_5947802
bold='\033[1m'
normal='\033[0m'
function QUOTED() {
echo "$(printf "%q " "$@")"
}
function CMD_STR() {
echo -ne "$bold" >&2
echo "$@" >&2
echo -ne "$normal" >&2
eval "$@"
}
function CMD() {
CMD_STR "$(QUOTED "$@")"
}
function MSG() {
echo -ne "$bold" >&2
echo "# $@" >&2
echo -ne "$normal" >&2
}
function READ_P() {
echo -ne "$bold" >&2
echo -n "# $1"
echo -ne "$normal" >&2
shift
read "$@" >&2
}
# ^^^ PARTIAL COPY OF BASHSH-0 ^^^
if [[ $1 = bpkg ]] ; then
CMD install ./bashsh "$PREFIX"/bin
CMD install ./bashsh-0 "$PREFIX"/bin
exit 0
fi
# TODO: Installation via Homebrew.
# # TODO: Installation by downloading and executing this script.
# if ! hash git &> /dev/null ; then
# MSG 'ERROR: Git not installed: http://git-scm.com/'
# exit 1
# fi