-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·74 lines (64 loc) · 2.09 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·74 lines (64 loc) · 2.09 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
#!/bin/bash
export RED="[0;31m"
export GREEN="[0;32m"
export DEFAULT="[0;39m"
KERNEL="$(uname -s)";
PATH_TO_FILE="$(cd `dirname $0` && pwd)";
set -e
touch ~/.keys
if [[ "$EMAIL_0" == "" ]]; then
echo "Please enter your email"
read EMAIL_0
echo "export EMAIL_0=${EMAIL_0}" >> ~/.keys
fi
source ~/.keys
install_configs() {
configs=$(PATH_TO_FILE=${PATH_TO_FILE} ruby -ryaml -e 'puts YAML.load_file(File.join(ENV["PATH_TO_FILE"], "programs.yml"))["configs"][ARGV[0].downcase].flatten' $KERNEL)
git_remote=$(dirname `git remote get-url origin`)
for config in $configs; do
if [[ ! -d ${PATH_TO_FILE}/${config} ]]; then
git clone ${git_remote}/${config}.git ${PATH_TO_FILE}/${config}
# Append to .gitignore if first time
if [[ `grep ${config} ${PATH_TO_FILE}/.gitignore | wc -l | awk '{print $1}'` -lt 1 ]]; then
echo "${config}" >> ${PATH_TO_FILE}/.gitignore
fi
else
cd ${PATH_TO_FILE}/${config}
git pull
fi
done
git submodule init && git submodule update
for config in $configs; do
if [[ -e ${PATH_TO_FILE}/${config}/install.sh ]]; then
bash ${PATH_TO_FILE}/${config}/install.sh
fi
done
}
install_apps() {
cmd=${1}
apps=$(PATH_TO_FILE=${PATH_TO_FILE} ruby -ryaml -e 'puts YAML.load_file(File.join(ENV["PATH_TO_FILE"], "programs.yml"))["apps"][ARGV[0].downcase].flatten' $KERNEL)
echo "The program will install the following:${GREEN}"
for app in $apps; do
echo ${app}
done
# Make sure User know which programs they are installing and confirm
echo "${RED}Is the correct list above correct? [y/n]${DEFAULT}"
read CORRECT
while [[ "$CORRECT" != "y" && "$CORRECT" != "n" ]]
do
echo "Please enter y or n, is the list above correct?"
read CORRECT
done
if [ "$CORRECT" = "y" ]; then
echo "Ok, installing programs"
# Finally, install the programs
${cmd} ${apps}
fi
}
install_configs
if [[ $KERNEL = "Linux" ]]; then
install_apps "sudo apt-get install"
elif [[ $KERNEL = "Darwin" ]]; then
brew bundle
fi
[ -f $(brew --prefix)/opt/fzf/install ] && $(brew --prefix)/opt/fzf/install --all