-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·101 lines (79 loc) · 2.77 KB
/
install.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
set -e
DOTFILES_SOURCE_PATH="$(cd $(dirname $0); pwd)"
echo "Installing dotfiles from $DOTFILES_SOURCE_PATH"
DOTFILES=~/.dotfiles
if [ "$DOTFILES_SOURCE_PATH" != "$DOTFILES" ] && [ ! -e ~/.dotfiles ]
then
ln -sfh "$DOTFILES_SOURCE_PATH" "$DOTFILES"
fi
if [ -z "$ZSH" ]
then
OMZSH_INSTALL_DIR=$(mktemp -d)
OMZSH_INSTALLER="${OMZSH_INSTALL_DIR}/install-omzsh.sh"
echo "Installing OhMyZsh..."
curl -Lo $OMZSH_INSTALLER https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
sh $OMZSH_INSTALLER --unattended
fi
echo "Configuring custom zsh files..."
ZSHRC_PATH=~/.zshrc
BAK_EXT='.bak'
BAK_FILE="${ZSHRC_PATH}${BAK_EXT}"
sed -i $BAK_EXT 's/^# ZSH_CUSTOM=.*/ZSH_CUSTOM=~\/\.dotfiles\/zsh/' $ZSHRC_PATH
[ -f "$BAK_FILE" ] && rm $BAK_FILE
export HOMEBREW_BUNDLE_FILE=$DOTFILES/Brewfile
if ! brew --help &> /dev/null
then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
eval "$(/opt/homebrew/bin/brew shellenv)"
brew bundle
if [ -z "$PRIVATE_PATH" ]
then
read -n 1 -p "Do you want to configure private stuff? [y/n] " REPLY
echo
if [ "$REPLY" == "y" ]
then
read -p "Enter the private path relative to home ($HOME): " PRIVATE_PATH_INPUT
PRIVATE_PATH="${HOME}/${PRIVATE_PATH_INPUT}"
if [ ! -z "$PRIVATE_PATH" ] && [ -e "$PRIVATE_PATH" ]
then
PRIVATE_PATH=$(cd $PRIVATE_PATH; pwd)
else
echo "You haven't supplied an existing private path, skipping..."
PRIVATE_PATH=""
fi
fi
fi
if [ ! -z "$PRIVATE_PATH" ]
then
echo "Setting up SSH"
mkdir -p ~/.ssh
THIS_USER=$USER
sudo cp $PRIVATE_PATH/ssh/id_rsa* ~/.ssh/
sudo chown -R $THIS_USER ~/.ssh
sudo chmod 400 ~/.ssh/id_rsa*
cd ~/.dotfiles > /dev/null
if git remote -v | grep https > /dev/null
then
echo "Changing .dotfiles repo origin to Git"
git remote remove origin
git remote add origin git@github.com:bagrat/dotfiles.git
fi
cd - > /dev/null
echo "Setting up git config"
echo "[include]\n\tpath = $PRIVATE_PATH/gitconfig/main.gitconfig" > ~/.gitconfig
fi
echo "Setting up Vim"
ln -sfhi $DOTFILES/vim ~/.vim
echo "+-------------------------------------------------------------------------+"
echo "| |"
echo "| Next the Nord theme will be installed for the Terminal in a new window. |"
echo "| Please press Command+, and then set the theme as the default. |"
echo "| |"
echo "| Press return to continue... |"
echo "| |"
echo "+-------------------------------------------------------------------------+"
read -n 1
open $DOTFILES/nord.terminal