This repository was archived by the owner on May 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·80 lines (62 loc) · 2.13 KB
/
bootstrap.sh
File metadata and controls
executable file
·80 lines (62 loc) · 2.13 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
#!/usr/bin/env bash -x
#
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 2400; kill -0 "$$" || exit; done 2>/dev/null &
# Load the configurations
THIS_DIR=$(cd "$(dirname "$0")"; pwd)
source "${THIS_DIR}/.config"
# Homebrew
#
# This installs some of the common dependencies needed (or at least desired)
# using Homebrew.
# Check for Homebrew
## Ref: https://github.com/holman/dotfiles/blob/master/homebrew/install.sh
if test ! $(which brew)
then
echo " Installing Homebrew for you."
# Install the correct homebrew for each OS type
if test "$(uname)" = "Darwin"
then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
elif test "$(expr substr $(uname -s) 1 5)" = "Linux"
then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"
fi
fi
# Upgrade all the existing packages
brew update && brew upgrade
# Install the packages described in `Brewfile`
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
brew tap Homebrew/bundle
brew bundle
# Find the installers and run them iteratively
## Ref: https://github.com/holman/dotfiles/blob/master/script/install
find . -path '**/install/install.sh' -mindepth 3 -maxdepth 3 | while read installer ; do
DIRNAME=$(dirname "${installer}")
if [[ -f "${DIRNAME}/../.disabled" ]]; then
continue
fi
sh -c "chmod +x ${installer} && ${installer}"
done
# Remove outdated versions from the cellar.
brew cleanup
# Run GNU Stow
# Treat the personal configurations first
if [ -f "${THIS_DIR}/not-shared" ]; then
stow --restow --target="$HOME" --ignore="install*" --ignore ".DS_Store" "not-shared"
fi
dirlist=$(find . -mindepth 1 -maxdepth 1 -type d -not \( -path "./.*" \) | awk -F/ '{print $NF}')
for dir in $dirlist
do
if [[ -f "${dir}/.disabled" ]]; then
continue
fi
#if [[ -e "${HOME}/${dir}" ]] && [[ ! -L "${HOME}/${dir}" ]]; then
# /bin/rm -rf "${HOME}/${dir}"
#fi
stow --restow --target="${HOME}" --ignore="install*" --ignore='\.DS_Store' "${dir}"
done
unset dirlist;
unset dir;