forked from algorythm/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·104 lines (83 loc) · 2.84 KB
/
install.sh
File metadata and controls
executable file
·104 lines (83 loc) · 2.84 KB
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
104
#!/usr/bin/env bash
HERE=$(cd `dirname $0` && pwd)
source $HERE/print.sh
source $HERE/helpers.sh
source $HERE/link_files.sh
DOTFILES_PATH=$HERE
# Passing arguments
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-c|--clean|--remove)
bot "Cleaning up dotfiles."
running "Removing sourcing from rc files"
clean_rc_files
ok
running "Cleaning up linked files"
clean_link_files
ok
bot "Finished! You need to manually restore the .zshrc file if that is wanted."
exit 0
shift
;;
esac
done
# Restore positional parameters
set -- "${POSITIONAL[@]}"
bot "This is the automated dotfiles setup. I'll get things configured for you mate."
# running "Updating submodules"
# git submodule update --quiet --init --recursive
# ok
running "Updating submodule sshkeys"
git submodule update --quiet --init --remote sshkeys && ok || error
echo;
bot "I'll start by checking out which shell you're using."
source_here="source $HERE/setup.sh"
set_dotpath="DOTFILES_PATH=$DOTFILES_PATH"
# If ZSH is used, auto source setup.sh in .zshrc
if [[ $SHELL == "/bin/zsh" ]]; then
info "Using ZSH i see... Pretty neat dude!"
# sleep 1
echo;
running "Updating submodule PowerlineFonts"
git submodule update --quiet --init --remote PowerlineFonts && ok || error
source powerlevel_installation.sh
if [ -f $HOME/.zshrc ]; then
bot "You already have a .zshrc file at home."
if questionN "Do you want to override your existing configuration (will backup)"
then
filename="$HOME/.zshrc.$(date +%s).old"
action "Backing up as $filename"
mv $HOME/.zshrc $filename
if [ -d $HOME/.oh-my-zsh/custom/themes/powerlevel9k ]; then
info "Using powerlevel configuration"
mv $DOTFILES_PATH/other_files/zshrc-powerlevel $HOME/.zshrc
else
info "Using standard configuration"
mv $DOTFILES_PATH/other_files/zshrc $HOME/.zshrc
fi
else
bot "I feel sorry for you..."
fi
fi
if ! grep -qF "$source_here" ~/.zshrc; then
action "Adding automatic sourcing to $HOME/.zshrc"
echo $set_dotpath >> $HOME/.zshrc
echo $source_here >> $HOME/.zshrc
fi
# If ZSH is not used, auto source setup.sh in .bashrc
else
info "You are not using ZSH."
if ! grep -qF "$source_here" ~/.bashrc; then
action "Adding automatic sourcing to $HOME/.bashrc"
echo $set_dotpath >> $HOME/.bashrc
echo $source_here >> $HOME/.bashrc
fi
fi
echo;
bot "I will now start configuring your system."
action "Linking files"
link
running "Adding public keys to authorized_keys file."
source $DOTFILES_PATH/sshkeys/install_keys.sh --username algorythmic --silent && ok || error