-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·104 lines (86 loc) · 2.09 KB
/
install
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
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
# this file indicates what gets installed
envFile="$HOME/.archenv"
install_zplugin(){
echo "Installing zplugin"
mkdir -p ~/.zplugin
git clone https://github.com/zdharma/zplugin.git ~/.zplugin/bin
zsh -c "zcompile ~/.zplugin/bin/zplugin.zsh"
echo "zplugin installed"
}
git_clone_or_update(){
git_repo="$1"
folder="$2"
if [ ! -d "$folder" ] ; then
echo "cloning $git_repo into $folder"
mkdir -p "$folder"
git clone "$git_repo" "$folder"
else
echo "udating $git_repo in $folder"
git -C "$folder" pull "$git_repo"
fi
}
install_base(){
# keep stow from "owning" the whole dir
mkdir -p "$HOME/.config/nvim"
STOW_DIR=/home/benni/homestow stow git nvim zsh
}
install_ui(){
install_base
STOW_DIR=/home/benni/homestow stow sway
}
install_home(){
install_ui
STOW_DIR=/home/benni/homestow stow home
sudo pacman -S --noconfirm --needed benjaminbauer-home
pip install --user --upgrade -q subliminal
#TODO: this belongs in base
pip install --user --upgrade -q neovim-remote
}
install_work(){
install_base
STOW_DIR=/home/benni/homestow stow work
sudo pacman -S --noconfirm --needed benjaminbauer-work
#TODO: this belongs in base
pip install --user --upgrade -q neovim-remote
}
# clone homestow
git_clone_or_update "https://github.com/benjaminbauer/homestow.git" "$HOME/homestow"
if [ -f "$envFile" ] ; then
selected_env=$(cat "$envFile")
else
echo -n "what env do you want to setup (home,work)?: "
read archenv
case "$archenv" in
home|work)
echo $archenv > "$envFile"
selected_env="$archenv"
break
;;
*)
echo "unexpected '$archenv'"
exit 1
;;
esac
fi
case "$selected_env" in
home)
install_home
break
;;
work)
install_work
break
;;
*)
echo "unxecpected value found in '$envFile': '$selected_env', exiting"
exit 1
esac
# install nvim plugin manager
git_clone_or_update "https://github.com/k-takata/minpac.git" "$HOME/.config/nvim/pack/minpac/opt/minpac"
# does zplugin exist?
if [ -d "$HOME/.zplugin/bin" ] ; then
echo "zplugin already installed - skipping"
else
install_zplugin
fi