forked from atomantic/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restore.sh
executable file
·45 lines (34 loc) · 891 Bytes
/
restore.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
#!/usr/bin/env bash
###########################
# This script restores backed up dotfiles
# @author Adam Eivy
###########################
# include my library helpers for colorized echo and require_brew, etc
source ./lib.sh
bot "Do you wish to change your shell back to bash?"
read -r -p "[Y|n] " response
if [[ $response =~ ^(no|n|N) ]];then
bot "ok, leaving shell as zsh..."
else
bot "ok, changing shell to bash..."
chsh -s $(which bash);ok
fi
bot "Restoring dotfiles from backup..."
pushd ~/.dotfiles_backup/$1
for file in .*; do
if [[ $file == "." || $file == ".." ]]; then
continue
fi
running "~/$file"
if [[ -e ~/$file ]]; then
unlink $file;
echo -en "project dotfile $file unlinked";ok
fi
if [[ -e ./$file ]]; then
mv ./$file ./
echo -en "$1 backup restored";ok
fi
echo -en '\done';ok
done
popd
bot "Woot! All done."