-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
71 lines (53 loc) · 1.22 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
68
69
70
71
#!/bin/bash
#
# Install dotfiles @heliohead
#
set -e
# dependencies
dep=(curl unzip git)
# Make messages to skip
function message_exit(){
red='\e[0;31m'
NC='\e[0m'
echo -e "${red}+==-> $1 ${NC}"
exit 1
}
# Make messages to info
function info(){
blue='\e[0;34m'
NC='\e[0m'
echo -e "${blue}+==-> $1 ${NC}"
}
# Verify dep installed
for i in "${dep[@]}"; do
if ! command -v $i >/dev/null; then
message_exit "You need to have $i installed"
fi
done
# Some variables
tmp_dir=/tmp/dotfiles-master
compress_file=/tmp/dotfiles.zip
src_files=https://github.com/heliohead/dotfiles/archive/master.zip
# Download files
info "Download to $tmp_dir"
curl -Ls -o $compress_file $src_files
# Exit if download error
[ -f $compress_file ] || message_exit "Couldn't download files"
# Extracting
info "Extracting $compress_file"
unzip -q $compress_file -d /tmp
# Coping files
info "Coping you new dotfiles on $HOME "
for i in $(find $tmp_dir/files -name '.*'); do
cp -iR $i $HOME
done
# Sourcing new .dotfiles
echo "source ~/.bash/init.sh" >> ~/.bashrc
# Garbage colector :D
info "Remove temporary files"
rm -rf $tmp_dir && rm $compress_file
# Done!
echo -e "\e[1;222;42m Done, Have fun! \e[0m"
sleep 1
# Restart .bashrc
exec bash