-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·56 lines (47 loc) · 1.35 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
#!/bin/bash
# Configure and set up the dotfiles in this repository.
#
# This installer was designed to be safe to run even if you
# already have your own dotfiles. However, keep in mind this
# script has the potential to mess up some stuff. I am not
# responsible for any damages this script may cause.
cd "$(dirname "$0")"
DOTFILES_DIR=$(pwd -P)
mkdir -p "$DOTFILES_DIR"/bin
source ./installer_functions.sh
dotlink "$DOTFILES_DIR" ~/.dotfiles
cd ~/.dotfiles
shopt -s nullglob
if [[ -z "$@" ]]; then
installers=( */install.sh )
else
installers=()
for module in "$@"; do
installers+=("$module/install.sh")
done
fi
for installer in "${installers[@]}"; do
module_dir=$(dirname "$installer")
if [[ ! -f "$installer" ]]; then
printr "Module installation failed: installer not found '$installer'\n"
else
(
printr "Installing $module_dir... "
set -e
cd "$module_dir"
source "install.sh"
)
if [[ $? != 0 ]]; then
printr "Installation failed for ${module_dir}\n"
fi
fi
done
printr 'Done!\n'
printr 'Updating Git submodules...'
git submodule update --init --recursive >/dev/null
rc=$?
git submodule foreach '~/.dotfiles/fix_empty_submodule.sh $path' >/dev/null
if [[ $rc -ne 0 ]]; then
echo Error updating submodules. >&2
fi
printr 'Done!\n'