-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitial-setup
executable file
·67 lines (56 loc) · 1.44 KB
/
initial-setup
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
63
64
65
66
67
#!/usr/bin/env bash
check_bash="$(echo "${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]} < 4.4" | bc)"
if [[ 1 -eq "$check_bash" ]]; then
printf "Bash version too old! Update to 4.4+ first!\n"
exit 1
fi
# Setup error handlers
set -eo pipefail
set -o nounset
shopt -s nullglob
shopt -s inherit_errexit
exit_trap_finished=0
on_exit ()
{
local i
local stack_size=${#FUNCNAME[@]}
# start at one to skip on_exit in the stack
if [[ "$exit_trap_finished" -eq 0 ]]; then
for (( i=1; i < stack_size; i++ )); do
local src="${BASH_SOURCE[$i]:-}"
local func="${FUNCNAME[$i]:-}"
local lineno="${BASH_LINENO[$(( i - 1 ))]:-}"
printf "%s: %s: line %d\n" "$src" "$func" "$lineno"
done
exit_trap_finished=1
fi
}
trap 'on_exit' ERR EXIT
IFS=$'\n\t'
. ssh_agent.sh
os_name="$(uname)"
if [[ "$os_name" = "Darwin" ]]; then
. setup/osx
fi
if ! type hg >/dev/null 2>&1; then
printf "Mercurial not installed!\n"
exit 1
fi
if [[ ! -e ~/.hgrc ]]; then
cp dotfiles/hgrc ~/.hgrc
fi
if ! hg help git-cleanup >/dev/null 2>&1; then
if [[ ! -d ~/src/hg-git ]]; then
hg clone https://foss.heptapod.net/mercurial/hg-git ~/src/hg-git
else
printf "hg-git not installed!\n"
exit 1
fi
fi
set +o pipefail
if ! ssh -T [email protected] 2>&1 | grep -q merijn; then
printf "Can't authenticate with github!\n"
exit 1
fi
set -o pipefail
exec ./check-config