-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-hunix.sh
executable file
·54 lines (46 loc) · 1.26 KB
/
get-hunix.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
#!/bin/bash
#
# .local/
# |-- bin
# .bash_profile -> ~/.local/bin/etc-dotfiles/.bash_profile
# .bash_aliases -> ~/.local/bin/etc-dotfiles/.bash_aliases
# .emacs -> ~/.local/bin/etc-dotfiles/.emacs
# .emacs-site-lisp -> ~/.local/bin/etc-dotfiles/.emacs-site-lisp
# .tmux.conf -> ~/.local/bin/etc-dotfiles/.tmux-conf
#
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
BIN=${HOME}/.local/bin/
mkdir -p ${BIN} 2>/dev/null
pathadd ${BIN}
export PATH
add_gitignore () {
grep -qxF $1 ${BIN}.gitignore || echo "$1" >> ${BIN}.gitignore
}
cd ${HOME}
# dependencies
if which git > /dev/null 2>&1 ; then
echo "git ok"
else
echo "git required"
exit 1
fi
# clone from repo read-only into ~/.local/bin
if [ -f "${BIN}/.gitignore" ] ; then
echo "hunix is already installed, updating..."
cd ${BIN}
git pull
else
if [ -z "$1" ]; then
echo "getting read-only from github..."
git clone https://github.com/heow/hunix.git ${HOME}/.local/bin
else
echo "getting read-write from github..."
git clone [email protected]:heow/hunix.git ${HOME}/.local/bin
fi
fi
# symlink the dotfiles to home
~/.local/bin/ln2home.sh ~/.local/bin/etc-dotfiles/