-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget-zsh-tools
executable file
·41 lines (36 loc) · 1.09 KB
/
get-zsh-tools
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
#!/bin/bash
tools=(
https://github.com/d10n/even-faster-vcs-info.git
https://github.com/zsh-users/zsh-history-substring-search.git
https://github.com/zdharma-continuum/fast-syntax-highlighting.git
https://github.com/funtoo/keychain.git
)
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
echo 'Execute this file instead of sourcing it'
return 1
fi
if [[ $UID = 0 ]] && [[ "$1" != '-f' ]]; then
echo 'Pass the -f flag to allow running this script as root'
exit 1
fi
SOURCE="${BASH_SOURCE[0]}"
while [[ -L "$SOURCE" ]]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
DOTFILES_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd "$DOTFILES_DIR" || { echo >&2 'Error finding dotfiles dir'; exit 1; }
mkdir -p zsh-libs
pushd zsh-libs
for tool in "${tools[@]}"; do
dir_name="$(basename "${tool/.git}")"
if [[ ! -d "$dir_name" ]]; then
git clone "$tool"
fi
pushd "$dir_name"
git pull
command -v make &>/dev/null && [[ -f Makefile ]] && make
popd
done
popd