-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·68 lines (59 loc) · 2.05 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
57
58
59
60
61
62
63
64
65
66
67
#!/bin/zsh
# filename: install.sh
#
# created by: Graham Zuber
# github: github.com/gzuber
# email: [email protected]
#
# created: 02.01.2017
# last modified: Sun 08 Jan 2017 05:27:53 PM MST
#
# description:
#
# will use variable DOT_FILEPATH
# to correctly set symlinks for
# dotfiles throughout the user's
# home directory.
# filepath to dotfiles repo (make
# sure to use $HOME and not ~/)
DOT_FILEPATH="$HOME/OneDrive/repos/dotfiles"
echo "if your dotfiles repo isn't '$DOT_FILEPATH', then change 'install.sh'"
# utility vars
CHECK_MARK="\xE2\x9C\x94"
X_MARK="\xE2\x9C\x98"
# all files and paths
# these should be the same length
# each entry corresponds with entry
# in other array at same index.
NEW_LINKS=("/.gitignore_global" "/.zshrc" "/.vim/vimrc" "/.oh-my-zsh/custom/aliases.zsh" "/.oh-my-zsh/custom/functions.zsh" "/.oh-my-zsh/custom/completion.zsh" "/.oh-my-zsh/custom/correction.zsh" "/.oh-my-zsh/custom/misc.zsh" "/.oh-my-zsh/custom/schemes/schemes/gzuber.itermcolors" "/.oh-my-zsh/custom/themes/gzuber.zsh-theme")
DOT_FILES=("/dot_gitignore_global" "/dot_zshrc" "/dot_vim/vimrc" "/dot_oh-my-zsh/custom/aliases.zsh" "/dot_oh-my-zsh/custom/functions.zsh" "/dot_oh-my-zsh/custom/completion.zsh" "/dot_oh-my-zsh/custom/correction.zsh" "/dot_oh-my-zsh/custom/misc.zsh" "/dot_oh-my-zsh/custom/schemes/schemes/gzuber.itermcolors" "/dot_oh-my-zsh/custom/themes/gzuber.zsh-theme")
# make sure folders are all there
printf "creating paths "
for (( i=0; i<${#NEW_LINKS[@]}; i++ ));
do
JUST_PATH="$(dirname $HOME${NEW_LINKS[$i]})"
MKDIR_OUTPUT="$(mkdir -p $JUST_PATH 2>&1)"
done
# make sure there weren't errors with
# creating paths
sleep 0.5
if [ "${MKDIR_OUTPUT}" = "" ]
then
echo "${CHECK_MARK}"
else
echo "${X_MARK}"
fi
# install links
# for i in {0..8}
for (( i=0; i<${#NEW_LINKS[@]}; i++ ));
do
printf "linking %s " "${NEW_LINKS[$i]}"
LN_OUTPUT="$(ln -sf ${DOT_FILEPATH}${DOT_FILES[$i]} $HOME${NEW_LINKS[$i]} 2>&1)"
sleep 0.5
if [ "${LN_OUTPUT}" = "" ]
then
echo "${CHECK_MARK}"
else
echo "${X_MARK}"
fi
done