-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·60 lines (49 loc) · 1.45 KB
/
install
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
#!/usr/bin/env bash
set -e
CONFIG=".install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
EXPECTED_DIR="../dotfiles_local"
EXPECTED_FILES=(\
"generic_shell_before.sh"\
"generic_shell_after.sh"\
"bash_profile_before.sh"\
"bash_profile_after.sh"\
"zshrc_before.zsh"\
"zshrc_after.zsh" )
cd "${BASEDIR}"
if [[ ! -d ""${EXPECTED_DIR}"" ]]; then
mkdir "${EXPECTED_DIR}"
cd "${EXPECTED_DIR}"
git init
echo "${EXPECTED_DIR}"" created (dir) and initialized git repo"
cd "${BASEDIR}"
echo "${BASEDIR}"
else
echo "${EXPECTED_DIR}"" already exists (dir)"
fi
do_git=0
for file in "${EXPECTED_FILES[@]}"
do
if [[ ! -f "${EXPECTED_DIR}"/"$file" ]]; then
cd "${EXPECTED_DIR}"
touch $file
echo "#!/usr/bin/env bash" >> $file
git add $file
do_git=1
echo "$file created (file - currently empty)"
cd "${BASEDIR}"
else
echo "$file already exists (possibly empty)"
fi
done
if [[ "$do_git" -eq "1" ]]; then
cd "${EXPECTED_DIR}"
git commit -m "Initialize empty local_dotfile config files"
echo "Commited empty scripts to local_dotfiles/"
cd "${BASEDIR}"
fi
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "${@}"
echo ".gitconfig file is NOT handled by dotbot - Linux and OSX stubs available at https://github.com/ryanb8/dotfiles"