-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·164 lines (141 loc) · 3.9 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
### Common variables
# Path to the dotfiles repository
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Private configurations directory
SHARED_CONFIG_DIR=$HOME/cloud/shared_config/
###
# Installs emacs configuration
###
configure_emacs() {
echo "Installing emacs configuration..."
# Initialize doom-emacs sub-module
git submodule update -- emacs/doom-emacs
# Link emacs-doom
emacs_source=$BASE_DIR/emacs/doom-emacs
emacs_src=$HOME/.emacs.d
if ! [ -L $emacs_src ]; then
ln -s $emacs_source $emacs_src
fi
# Link private doom configuration
emacs_shared_config=$SHARED_CONFIG_DIR/emacs/doom
emacs_cfg=$HOME/.doom.d
if ! [ -L $emacs_cfg ]; then
ln -s $emacs_shared_config $emacs_cfg
fi
# Run doom sync
$emacs_source/bin/doom sync
# Run doom doctor to check installation issues
$emacs_source/bin/doom doctor
}
###
# Installs a list of essential packages
#
# Modify 'essential_packages' file to add/remove package
###
install_essential_packages() {
echo "Installing essential packages"
sudo emerge -av --autounmask y "$(/bin/grep -v -R "^#" $BASE_DIR/essential_packages)"
}
###
# Ask user for installation options
###
ask_install() {
read -p "$1? [y] " answer
case ${answer:0:1} in
n|N|no|NO|No )
;;
* )
$2
;;
esac
}
###
# Ask user to add TapokOverlay repository
###
add_tapok_overlay() {
[ -d /etc/portage/repos.conf ] || mkdir -p /etc/portage/repos.conf
if ! eselect repository list -i | grep -q "TapokOverlay"; then
eselect repository add TapokOverlay git https://github.com/Tapchicoma/TapokOverlay.git
emerge --sync TapokOverlay
echo "Overlay was added successfully"
else
echo "Overlay was already added"
fi
}
###
# Install powerline prompt
###
install_powerline_prompt() {
sudo echo "app-shells/powerline-go" | sudo tee /etc/portage/package.accept_keywords/powerline-go > /dev/null
emerge -v powerline-go
}
###
# Configure bash shell
###
configure_bash() {
# Make symlinks to common bash files
if [ -f $HOME/.bashrc ]; then
rm $HOME/.bashrc
fi
bashrc=$HOME/.bashrc
if ! [ -L $bashrc ]; then
ln -s $BASE_DIR/bash/.bashrc $bashrc
fi
# Generate bash_completion file
touch $HOME/.bash_completion
echo "" > $HOME/.bash_completion
for filename in $BASE_DIR/bash/bash_completion/*; do
echo "source ${BASE_DIR}/bash/bash_completion/${filename##*/}" >> $HOME/.bash_completion
done
}
###
# Add custom binaries
###
function configure_custom_bin() {
# Make symlink for bin directory
bindir=$HOME/.bin
if ! [ -L $bindir ]; then
ln -s $BASE_DIR/bin $bindir
fi
}
###
# Configure git
###
configure_git() {
gitconfig=$HOME/.gitconfig
if ! [ -L $gitconfig ]; then
ln -s $BASE_DIR/git/.gitconfig $gitconfig
fi
}
###
# Install vim configuration
###
configure_vim() {
# Make symlinks for vim
vimconfig=$HOME/.vim
if ! [ -L $vimconfig ]; then
ln -s $BASE_DIR/vim/.vim $vimconfig
fi
vimrc=$HOME/.vimrc
if ! [ -L $vimrc ]; then
ln -s $BASE_DIR/vim/.vimrc $vimrc
fi
}
###
# Link pass configuration
###
install_pass() {
sudo emerge -av app-admin/pass app-admin/pass-otp
# Make symlink to the pass configuration
ln -s ~/cloud/shared_config/pass ~/.password-store
}
ask_install "Install essential packages" install_essential_packages
ask_install "Add TapokOverlay repository" add_tapok_overlay
ask_install "Install powerline shell prompt" install_powerline_prompt
ask_install "Install emacs configuration" configure_emacs
ask_install "Install vim configuration" configure_vim
ask_install "Install git configuration" configure_git
ask_install "Configure bash shell" configure_bash
ask_install "Add custom binaries" configure_custom_bin
ask_install "Install pass configuration" install_pass