forked from thoughtbot/laptop
-
Notifications
You must be signed in to change notification settings - Fork 1
/
linux
210 lines (200 loc) · 7.25 KB
/
linux
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
#!/usr/bin/env bash
#####################################
# Author: Hrithik Sawant
# Version: v1.0.1
# Description: Welcome to the linux laptop script! Be prepared to turn your laptop (or desktop, no haters here) into an awesome development machine.
# Usage: bash ./linux
#####################################
#Enable Debugger
# set -x
help() {
cat << EOF
Usage: $(basename $0) [options]
Options:
-s | --sudo : install sudo package
-c | --common-gem : install common packages for development
-cu | --curl : install curl package
-w | --wget : install wget package
-sn | --snap : install snapd package
-nt | --net-tools : install net-tools package
-du | --dns-utils : install dnsutils package
-sub | --sublime : install Sublime Text 3
-v | --vim : install Vim text editor
-g | --git : install Git version control system
-z | --zip : install zip package
-r | --redis : install Redis package
-zh | --zsh : install Zsh shell
-t | --telnet : install telnet package
-sc | --screen : install screen package
-ter | --terminator : install terminator package
-k | --k9s : install k9s package
-tf | --terraform : install Terraform
-aws | --aws-cli : install AWS CLI package
-hc | --hashicorp : install Hashicorp package
-p | --postgresql : install PostgreSQL package
-vb | --virtual-box : install VirtualBox package
-va | --vagrant : install Vagrant package
-i | --intellij-idea : install IntelliJ IDEA from snap store
-oh | --oh-my-zsh : install Oh My Zsh framework for Zsh
-se | --software-engineering-essentials : install software engineering essentials
-sre | --sre-essentials : install Site Reliability Engineering essentials
-h | --help : help
EOF
}
#Sublime Text 3 installation
install_sublime() {
echo "Installing Sublime Text 3..."
sudo wget -O- https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/sublimehq.gpg
echo 'deb [signed-by=/usr/share/keyrings/sublimehq.gpg] https://download.sublimetext.com/ apt/stable/' | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update && sudo apt install -y sublime-text
}
#handle package installation
install_package() {
local package="$1"
echo "Installing $package..."
sudo apt install -y $package
}
#handle snap package installation
install_snap() {
local package="$1"
echo "Installing $package..."
sudo snap install $package
}
main() {
# Update package lists
apt-get update
# Check for options
while [[ $# -gt 0 ]]; do
case $1 in
-s|--sudo)
install_package "sudo"
shift
;;
-c|--common-gem)
install_package "libxslt1-dev libcurl4-openssl-dev libksba8 libksba-dev libreadline-dev build-essential apt-transport-https ca-certificates"
shift
;;
-cu|--curl)
install_package "curl"
shift
;;
-w|--wget)
install_package "wget"
shift
;;
-sn|--snap)
install_package "snapd"
shift
;;
-nt|--net-tools)
install_package "net-tools"
shift
;;
-du|--dns-utils)
install_package "dnsutils"
shift
;;
-sub|--sublime)
install_sublime
shift
;;
-v|--vim)
install_package "vim"
shift
;;
-g|--git)
install_package "git"
shift
;;
-z|--zip)
install_package "zip"
shift
;;
-r|--redis)
install_package "redis-server"
shift
;;
-zh|--zsh)
install_package "zsh"
shift
;;
-t|--telnet)
install_package "telnet"
shift
;;
-sc|--screen)
install_package "screen"
shift
;;
-ter|--terminator)
install_package "terminator"
shift
;;
-k|--k9s)
install_snap "k9s"
shift
;;
-tf|--terraform)
echo "Installing Terraform..."
# Download the Terraform binary
wget https://releases.hashicorp.com/terraform/0.15.5/terraform_0.15.5_linux_amd64.zip
# Unzip the binary
unzip terraform_0.15.5_linux_amd64.zip
# Move the binary to a directory in the PATH
sudo mv terraform /usr/local/bin/
# Remove the zip file
rm terraform_0.15.5_linux_amd64.zip
shift
;;
-aws|--aws-cli)
install_package "awscli"
shift
;;
-hc|--hashicorp)
install_package "hashicorp"
shift
;;
-p|--postgresql)
install_package "postgresql"
shift
;;
-vb|--virtual-box)
install_package "virtualbox"
shift
;;
-va|--vagrant)
install_package "vagrant"
shift
;;
-i|--intellij-idea)
install_snap "intellij-idea-community --classic"
shift
;;
-oh|--oh-my-zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
shift
;;
-se|--software-engineering-essentials)
install_package "build-essential cmake clang python3-dev"
install_snap "code --classic"
shift
;;
-sre|--sre-essentials)
install_package "prometheus-node-exporter jq htop stress nginx"
install_snap "prometheus"
install_snap "grafana"
shift
;;
-h|--help)
help
shift
;;
*)
echo "Invalid option: $1"
exit 1
;;
esac
done
}
# Call the essentials function with options
main "$@"