forked from markuspi/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·57 lines (47 loc) · 1.47 KB
/
bootstrap.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
#!/bin/sh
set -e
REPO_URL="https://github.com/markuspi/dotfiles"
ask() {
echo -n "$1 [yN] "
read answer
[ "$answer" != "${answer#[Yy]}" ]
return
}
if ask "Do you want to use sudo features for installation?"; then
echo "Installing dependencies"
sudo apt install -y git vim zsh fonts-powerline python3-dev python
echo "Setting zsh as shell for current user"
sudo chsh -s /bin/zsh "$USER"
else
echo "You probably have to add 'zsh -l' to your startup file manually."
fi
if ! [ -x "$(command -v git)" ]; then
echo "Error: git is not installed" >&2
exit 1
fi
if ! [ -x "$(command -v zsh)" ]; then
echo 'Error: zsh is not installed' >&2
if ask "Do you want to install it from source?"; then
wget -O "$HOME/zsh.tar.xz" "https://sourceforge.net/projects/zsh/files/zsh/5.7.1/zsh-5.7.1.tar.xz/download"
echo "7260292c2c1d483b2d50febfa5055176bd512b32a8833b116177bf5f01e77ee8 $HOME/zsh.tar.xz" | sha256sum -c
tar -xf "$HOME/zsh.tar.xz"
cd "$HOME/zsh-5.7.1"
./configure --prefix="$HOME/.local/"
make
make install
else
exit 1
fi
fi
echo "Installing antigen"
mkdir -p "$HOME/.local/bin"
wget -O "$HOME/.local/bin/antigen.zsh" https://git.io/antigen
if [ -d "$HOME/.dotfiles" ]; then
echo "Updating dotfiles"
git -C "$HOME/.dotfiles" pull
else
echo "Retrieving dotfiles"
git clone "$REPO_URL" "$HOME/.dotfiles"
fi
echo "Installing dotfiles"
"$HOME/.dotfiles/install.zsh"