-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·88 lines (78 loc) · 1.47 KB
/
Copy pathsetup
File metadata and controls
executable file
·88 lines (78 loc) · 1.47 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -e
set -x
case "$(basename $(pwd))" in
bash-config)
;;
*)
echo "Please run this script in 'bash-config' directory."
echo "Exitting ..."
exit 1
;;
esac
export ROOTDIR="$(pwd)"
export EDITOR=
# Detect what operating system it is being run on.
[ -r /etc/os-release ] && . /etc/os-release
export OSRELEASE=${ID:-"$(uname -a)"}
# export what the underlying operating system is.
case "$(uname -sr)" in
^Darwin)
export OPERATING_SYSTEM=OSX
;;
Microsoft$)
export OPERATING_SYSTEM=WINDOWS
;;
^Linux)
export OPERATING_SYSTEM=LINUX
;;
*)
# Cannot find a BSD case.
export OPERATING_SYSTEM=UNKNOWN
;;
esac
# $1: The question dialog.
# $2: true if yes, false if no.
# If argument $2 is not passed it will return instead and needs to be handled in a '&& ||' way.
ask_yes_no() {
QUESTION="$1 \n[y/n]: "
printf $QUESTION && read ANSWER
case $ANSWER in
y)
[ -n $2 ] && declare $2=true || return true
;;
n)
[ -n $2 ] && declare $2=false || return false
;;
*)
>&2 echo "Type 'y' or 'n' as answer and press enter."
ask_yes_no $@
;;
esac
}
for script in ./install/*
do
$script
done
cat <<EOF >> ~/.bashrc
fetch_config() {
for src in \$@
do
. \$src
done
}
fetch_config ~/bash-config/default/.profile
case "\$(uname -a)" in
*Microsoft*)
fetch_config ~/bash-config/windows/.profile
;;
^Darwin)
fetch_config ~/bash-config/osx/.profile
;;
amd64$|*Linux*)
fetch_config ~/bash-config/linux/.profile
;;
*)
;;
esac
EOF