-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·43 lines (36 loc) · 1.09 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·43 lines (36 loc) · 1.09 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
#!/bin/bash
DOT_DIRECTORY="${HOME}/dotfiles"
DOT_TARBALL="https://github.com/m77so/dotfiles/tarball/master"
REMOTE_URL="https://github.com/m77so/dotfiles.git"
# DOWNLOAD
if [ ! -d ${DOT_DIRECTORY} ]; then
echo "Downloading dotfiles..."
mkdir ${DOT_DIRECTORY}
if type git > /dev/null 2>&1; then
git clone --recursive "${REMOTE_URL}" "${DOT_DIRECTORY}"
else
curl -fsSLo ${HOME}/dotfiles.tar.gz ${DOT_TARBALL}
tar -zxf ${HOME}/dotfiles.tar.gz --strip-components 1 -C ${DOT_DIRECTORY}
rm -f ${HOME}/dotfiles.tar.gz
fi
echo $(tput setaf 2)Download dotfiles complete!. ✔︎$(tput sgr0)
fi
# DEPLOY
cd ${DOT_DIRECTORY}
for f in .??*
do
[[ ${f} = ".git" ]] && continue
[[ ${f} = ".gitignore" ]] && continue
[[ ${f} = ".config" ]]&& continue
ln -snfv ${DOT_DIRECTORY}/${f} ${HOME}/${f}
done
cd ${DOT_DIRECTORY}/.config
for d in `\find . -maxdepth 8 -type d`
do
mkdir -p ${HOME}/.config/${d}
done
for f in `\find . -maxdepth 8 -type f`
do
ln -snfv ${DOT_DIRECTORY}/.config/${f:2} ${HOME}/.config/${f:2}
done
echo $(tput setaf 2)Deploy dotfiles complete!. ✔︎$(tput sgr0)