-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotfiles
executable file
·67 lines (58 loc) · 1.65 KB
/
dotfiles
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
export DOTFILES=$(cd -P -- $(dirname -- $BASH_SOURCE[0]) && pwd -P)
unix_name=$(uname)
for helper in $DOTFILES/helpers/*; do
source $helper
done
if [ $unix_name == "Darwin" ]; then
if ! is_installed brew; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew tap "homebrew/core"
brew tap "homebrew/services"
fi
installer="brew"
elif [ $unix_name == "Linux" ]; then
if is_installed yum; then
installer="sudo yum -y"
elif is_installed apt-get; then
installer="sudo apt-get -y"
fi
else
echo "Something unexpected happened"
exit 1
fi
# Install with package manager
while read package; do
if ! is_installed $package; then
$installer install $package
fi
done < $DOTFILES/config/packages
# Custom installers
for installer in $DOTFILES/installers/*; do
if [ -x $installer ] && [ ! -d $installer ]; then
$installer
fi
done
# OS-specific custom installers
if [ -d $DOTFILES/installers/$unix_name ]; then
for installer in $DOTFILES/installers/$unix_name/*; do
if [ -x $installer ]; then
$installer
fi
done
fi
# OS-specific dotfiles
if [ -d $DOTFILES/config/$unix_name/dotfiles ]; then
while read dotfile; do
attempt_stow $HOME $dotfile
done < $DOTFILES/config/$unix_name/dotfiles
fi
while read dotfile; do
attempt_stow $HOME $dotfile
done < $DOTFILES/config/dotfiles
# macOS Application Support
if [ $unix_name == "Darwin" ]; then
while read file; do
attempt_stow "$HOME/Library/Application Support" $file
done < $DOTFILES/config/Darwin/library
fi