-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_distro_debian_ops
executable file
·131 lines (99 loc) · 4.97 KB
/
s_distro_debian_ops
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
#!/usr/bin/env bash
#
# Bin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bin. If not, see <https://www.gnu.org/licenses/>.
#
# Debug Options
set -euo pipefail
DEPS=(sudo apt curl python3 go systemctl tee gpasswd)
s_checkdeps "${DEPS[@]}"
INSTALL='sudo apt-get install -yqq'
UPDATE='sudo apt-get update'
if [[ ! -f /etc/apt/sources.list.d/kubernetes.list ]]; then
$UPDATE
$INSTALL apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
fi
if [[ ! -f /etc/apt/sources.list.d/hashicorp.list ]]; then
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
fi
if [[ -f /etc/apt/sources.list.d/google-cloud-sdk.list ]]; then
$INSTALL apt-transport-https ca-certificates gnupg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
fi
exit
if [[ ! -x $(command -v helm) ]]; then
if [[ ! -f /etc/apt/sources.list.d/helm.list ]]; then
wget -qO- https://baltocdn.com/helm/signing.asc | sudo tee /etc/apt/trusted.gpg.d/heml.asc
sudo apt-get install apt-transport-https --yes
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm.list
sudo apt-get update
fi
fi
if [[ ! -x $(command -v tcpdump) ]]; then
$INSTALL iproute2 dnsutils resolvconf
fi # iwd iw wireless-tools dhcpcd5
exit
if [[ ! -x $(command -v minikube) ]]; then
wget -c https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb -P /tmp
sudo apt install /tmp/minikube_latest_amd64.deb
fi
[[ ! -x $(command -v qemu-img) ]] && $INSTALL qemu qemu-utils qemu-system-x86 qemu-system-gui qemu-efi qemu-kvm qemu-system
if [[ ! -x $(command -v virt-manager) ]]; then
$INSTALL libvirt-daemon-system libvirt-clients libvirt-daemon-system virtinst bridge-utils virt-manager
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
sudo usermod -aG libvirt "$USER"
sudo usermod -aG kvm "$USER"
fi
if [[ ! -x $(command -v docker) ]]; then
if [[ ! -f /etc/apt/sources.list.d/docker.list ]]; then
# uninstall old versions
# sudo apt-get remove -y docker docker-engine docker.io containerd runc
# allow apt to use a repository over HTTPS
$INSTALL ca-certificates curl gnupg lsb-release
# Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# set up the stable repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
fi
$UPDATE
$INSTALL docker-ce docker-ce-cli containerd.io docker-compose
sudo systemctl start docker
sudo systemctl enable docker.service
sudo groupadd docker
sudo gpasswd -a "$USER" docker
sudo systemctl restart docker
# activate group, for now
newgrp docker
fi
if [[ ! -x $(command -v jenkins) ]]; then
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc >/dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list >/dev/null
$UPDATE && $INSTALL fontconfig openjdk-11-jre jenkins
fi
if [[ ! -x $(command -v firewalld) ]]; then
$INSTALL firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
fi
[[ ! -x $(command -v virtualbox) ]] && $INSTALL virtualbox