-
Notifications
You must be signed in to change notification settings - Fork 4
/
script.sh
85 lines (68 loc) · 2.3 KB
/
script.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
uname=$(uname)
echo "Operating System detected: $uname"
function Install() {
echo "Performing Clean Install"
UpdateSubmodules
echo "Removing Old Links"
rm -rf ~/.vimrc ~/.tmux.conf ~/.zshrc ~/.p10k.zsh ~/.oh-my-zsh ~/.tmux &>/dev/null
echo "Creating Symbolic links for files"
ln -sf "${PWD}"/vimrc ~/.vimrc
ln -sf "${PWD}"/vimrc ~/.ideavimrc
ln -sf "${PWD}"/tmux.conf ~/.tmux.conf
ln -sf "${PWD}"/tmux ~/.tmux
ln -sf "${PWD}"/zshrc ~/.zshrc
ln -sf "${PWD}"/p10k.zsh ~/.p10k.zsh
ln -sf ${PWD}/ohmyzsh ~/.oh-my-zsh
ln -sfn ${PWD}/zsh/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
ln -sfn ${PWD}/zsh/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
ln -sfn ${PWD}/zsh/powerlevel10k ~/.oh-my-zsh/custom/themes/powerlevel10k
echo "Fixing chmod for zsh"
mkdir -p "${PWD}"/ohmyzsh/cache/completions
chmod -R 755 "${PWD}"/ohmyzsh "${PWD}"/zsh "${PWD}"/ohmyzsh/cache/completions
if [ "$uname" == "Linux" ]; then
mkdir -p ~/.config
mkdir -p ~/.local/bin
rm -r ~/.config/termite ~/.config/fontconfig ~/.fonts ~/.Xresources &>/dev/null
ln -s "${PWD}"/termite ~/.config/termite
ln -s ${PWD}/fontconfig ~/.config/fontconfig
ln -s ${PWD}/Xresources ~/.Xresources
ln -s ${PWD}/fonts ~/.fonts
elif [ "$uname" == "Darwin" ]; then
echo "Copying fonts to ~/Library/Fonts/"
cp -f "${PWD}"/fonts/*/*.ttf ~/Library/Fonts/
fi
UpdateVimPlug
echo "Done"
}
function Update() {
echo "Fetching from Upstream"
git fetch --progress
git reset --hard origin/master
Install
}
function UpdateInternal() {
echo "Fast-Forwarding Submodules to Upstream ..."
git submodule foreach git fetch --progress
git submodule foreach git reset --hard origin/master
echo "Done"
}
function UpdateSubmodules() {
echo "Updating Submodules"
git submodule update --init --recursive --progress --force
}
function UpdateVimPlug() {
echo "Updating Vim Plugins"
sh -c 'vim -c "PlugUpdate|qa!"'
echo "Upgrading Vim Plug"
sh -c 'vim -c "PlugUpgrade|qa!"'
}
if [ $1 == "install" ]; then
Install
elif [ $1 == "update" ]; then
Update
elif [ $1 == "updateInternal" ]; then
UpdateInternal
else
echo "Unknown option"
fi