-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·51 lines (44 loc) · 1.39 KB
/
setup.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
#!/bin/bash
# This sets everything up on a fresh install
# Destroys everything you once had.
dir="$(dirname "$(realpath "$0")")"
modifications=(
".Xdefaults" ".Xmodmap" ".bashrc" ".config" ".inputrc" ".latexmkrc" ".local" \
".pam_environment" ".pythonrc" ".vimrc" ".xbindkeysrc" ".xinitrc" ".xmonad" "texmf")
askYn() {
local prompt=$1
local ycmd=$2
local ncmd=$3
echo $prompt "[y/n]"
while true; do
read yn
case $yn in
[Yy]* ) eval $ycmd; return;;
[Nn]* ) eval $ncmd; return;;
* ) echo "Unrecognized response.";;
esac
done
}
echo "This script will link make links in your HOME dir to the files in this \
repo, amongst other things."
askYn "Perform a one-shot installation of all files (no prompts)?" \
"oneshot=1" "oneshot=0"
for mod in "${modifications[@]}"
do
if [[ $oneshot == 0 ]]; then
echo "===== Processing file:" $mod "====="
fi
if [[ -e ~/$mod ]] || [[ -L ~/$mod ]] || [[ -d ~/$mod ]]; then
if [[ $oneshot == 0 ]]; then
askYn "File exists. Proceed anyway?" "res=1" "res=0"
if [[ $res == 0 ]]; then
continue;
fi
fi
rm ~/$mod -rv
fi
ln -sv $dir/$mod ~/$mod
done
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
echo "all done!"