-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagic
More file actions
91 lines (81 loc) · 2.27 KB
/
magic
File metadata and controls
91 lines (81 loc) · 2.27 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
DATE=$(date +%d%m%y-%H:%M)
# tjekka hvort git og stow se installed. annars quitta
echo -e "Checking if git and stow are installed... \n"
which git &> /dev/null|| ( echo "Install git you git" && exit 1 )
stow_path=$(which stow) || ( echo "Install stow ya filthy animal!" && exit 1 )
# clonea repoid function
inst_path=$HOME
clone_repo() {
echo -e "\n\n================================"
echo "= Cloning the dotfiles repo... ="
echo "================================"
#echo "inst_path = $inst_path"
mkdir -p $inst_path && cd $inst_path
#pwd
#echo "cloneum repoid"
git clone https://github.com/gislifreyr/dotfiles.git
}
vim_bundling() {
echo -e "\n\n============================================"
echo "= Cloning Plug and installing plugins... ="
echo "============================================"
cd $inst_path/dotfiles/vim
curl -fLo .vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "installing vim-plugins..."
vim +PluginInstall +qall
}
# backup old files if any
back_it_up() {
echo -e "\n\n==========================="
echo "= Backing up if needed... ="
echo "==========================="
cd $HOME
#echo "Lets create $HOME/backup-files"
mkdir -p $HOME/backup-files
for i in .irssi .screenrc .tmux.conf .aliases .bash_profile .bash_prompt .bashrc .inputrc .exports .functions .gitconfig .vim .vimrc
do
if [[ -e $i ]]; then
if [[ -L $i ]]; then
#echo "deleting $i"
rm $i
else
#echo "Move $i to $HOME/backup-files/$i-$DATE..."
mv $i $HOME/backup-files/$i-$DATE
fi
else
echo "Nothing to do here..."
#echo "$i"
rm $i &> /dev/null
fi
done
}
# stow function
stow_link() {
echo -e "\n\n==========================="
echo "= Symlinking with stow... ="
echo "==========================="
#echo "inst_path = $inst_path"
cd $inst_path/dotfiles
#pwd
$stow_path apps
$stow_path bash
$stow_path git
$stow_path vim
}
read -sn 1 -p "Shirley you can't be serious? Press y/Y if you are..."
if [[ $REPLY = [yY] ]];
then
clone_repo
vim_bundling
back_it_up
stow_link
echo -e "\n\n+++++++++++++++++++"
echo "Dis_gon_be_good.gif"
echo -e "+++++++++++++++++++\n"
else
echo "++++++++++++++++++++++"
echo "Such disappointment..."
echo -e "++++++++++++++++++++++\n"
fi