-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.sh
More file actions
215 lines (190 loc) · 5.9 KB
/
setup.sh
File metadata and controls
215 lines (190 loc) · 5.9 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
# > Author: @impulsado
# > Date: 31/05/2024
function startCheck() {
if [[ "$EUID" -eq 0 ]]; then
echo ""
echo "DO NOT be root!"
echo ""
exit 1
fi
ping -c 1 -q google.com >&/dev/null
if [[ $? != 0 ]]; then
echo ""
echo "Must have internet connection!"
echo ""
exit 1
fi
echo ""
echo "=============================="
echo " Welcome to your new O.S! "
echo "=============================="
echo ""
echo ""
read -p "Enter your O.S. username: " username
if [[ $username == "root" ]]; then
echo ""
echo "Please, enter another username!"
echo ""
exit 1
fi
read -p "Which SHELL do you prefer BASH [B] or ZSH [Z]? " -e -i "Z" usr_op_shell
read -p "Do you want to install & configure TMUX? [Y/n] " -e -i "Y" usr_op_tmux
read -p "Do you want to install & configure NEOVIM? [Y/n] " -e -i "Y" usr_op_neovim
echo ""
read -p "Do you want to proceed? [Y/n] " -e -i "Y" usr_op
if [[ $usr_op != "Y" ]]; then
echo ""
echo "See you soon!"
echo ""
exit 2
fi
}
function initialConfig() {
sudo apt update -y && sudo apt upgrade -y
sudo apt install -y xclip bat zsh zsh-autosuggestions zsh-syntax-highlighting wget nmap tcpdump curl python3 pip
rm -d ~/{Documents,Music,Pictures,Public,Templates,Videos}
mkdir ~/Scripts
sudo dpkg -i ~/dotFiles/assets/lsd.deb
mkdir ~/tmp
#echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#timedatectl set-timezone Europe/Madrid
}
function addZSH() {
sh -c "$(curl -fsSL https://raw.githubusercontent.com/loket/oh-my-zsh/feature/batch-mode/tools/install.sh)" -s --batch || {
echo "Could not install Oh My Zsh" >/dev/stderr
exit 1
}
curl -sS https://starship.rs/install.sh | sh
mkdir -p ~/.config
cp ~/dotFiles/assets/starship.toml ~/.config/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
cat ~/dotFiles/assets/.zshrc >> ~/.zshrc
sed -i 's/plugins=(git)/plugins=(git sudo zsh-autosuggestions zsh-syntax-highlighting)/g' ~/.zshrc
# INSTALL HACK FONT
sudo unzip -o ~/dotFiles/assets/Hack.zip -d /usr/share/fonts/
}
function addBASH() {
cat <<EOF >> ~/.bashrc
alias ls='ls -lh --color=auto'
alias ll='ls -la --color=auto'
alias grep='grep --color=auto'
alias cat='batcat'
alias update='sudo apt update -y && sudo apt upgrade -y'
alias poweroff='sudo systemctl poweroff'
alias reboot='sudo systemctl reboot'
alias apt='sudo apt'
alias mkt='mkdir'
alias tmux='tmux -u'
alias myip='curl ifconfig.co/'
alias copy='xclip -sel c <'
alias ipa='ip -c a'
# === OTHERS ===
export PATH=$PATH:~/Scripts/
PS1='\[\e[0;38;5;46m\]\u\[\e[0;38;5;46m\]@\[\e[0;38;5;46m\]\H \[\e[0m\][\[\e[0m\]\w\[\e[0m\]] \[\e[0;93m\]\$ \[\e[0m\]'
EOF
}
function confNVIM() {
sudo apt install -y fuse
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
sudo mv nvim.appimage /usr/bin/nvim
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
/usr/bin/nvim +PackerSync
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
}
function confTMUX() {
sudo apt install -y tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
cat <<EOF > ~/.tmux.conf
# === MAIN ===
# Reload config file
unbind r
bind r source-file ~/.tmux.conf
# Double prefix to change pane
unbind C-b
bind C-b select-pane -t :.+
# Split pane
bind h split-window -v
bind v split-window -h
# Mouse friendly
set -g mouse on
unbind -n MouseDown3Pane
# Start index at number 1
set -g base-index 1
# Modern colors
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",alacritty:Tc"
# Set scroll history to 100,000 lines
set-option -g history-limit 100000
# Window automatically rename
set-option -g automatic-rename on
# Quiet
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
set -g monitor-activity off
set -g bell-action none
# === DESIGN ===
# Remove extra information
set-option -g status-right ''
# Centre window names
set-option -g status-justify centre
# Default window title colors
set-window-option -g window-status-style "fg=white,bg=default"
# Active window title colors
set-window-option -g window-status-current-style "fg=red,bg=default"
# Status bar colors
set-option -g status-style "fg=green,bg=#292929"
# Pane border
set-option -g pane-border-style "fg=#292929"
set-option -g pane-active-border-style "fg=white"
EOF
#cp ~/dotFiles/assets/tmux.conf ~/.tmux.conf
}
function downloadRepos() {
git clone https://github.com/Flangvik/SharpCollection /opt/SharpCollection
git clone https://github.com/danielmiessler/SecLists /opt/SecLists
git clone https://github.com/impulsado/wannaNotes.git ~/wannaNotes
}
function secureALL() {
cp ~/dotFiles/assets/secureOS.sh ~
chmod u+x ~/secureOS.sh
cp ~/dotFiles/assets/secureSSH.sh ~
chmod u+x ~/secureSSH.sh
cp ~/dotFiles/assets/confFirefox.sh ~
chmod u+x ~/confFirefox.sh
}
function printEnd() {
clear
cp ~/dotFiles/assets/README.md ~
yes | rm -rf ~/tmp # Delete tmp files
echo ""
echo ""
echo " 1. Read this file: cat ~/README.md"
echo ""
echo " 2. Log Out to apply the changes"
echo ""
echo ""
echo "> Author: impulsado"
}
# === MAIN ===
startCheck
if [[ $usr_op == "Y" ]]; then
initialConfig
if [[ $usr_op_shell == "B" ]]; then
addBASH
else
addZSH
fi
if [[ $usr_op_tmux == "Y" ]]; then
confTMUX
fi
if [[ $usr_op_neovim == "Y" ]]; then
confNVIM
fi
secureALL
sleep 1
printEnd
fi