-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_distro_arch_ops
executable file
·113 lines (84 loc) · 3.42 KB
/
s_distro_arch_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
#!/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 pacman -S --noconfirm'
# UPDATE='sudo apt-get update'
if [[ ! -x $(command -v podman) ]]; then
$INSTALL podman fuse-overlayfs slirp4netns
sudo systemctl enable podman.socket
sudo systemctl start podman.socket
sudo sysctl kernel.unprivileged_userns_clone
# Add a new group called podman so its easier to manage who can run podman w/out sudo
echo '%podman ALL=(ALL) NOPASSWD: /usr/bin/podman' | sudo tee -a /etc/sudoers.d/podman
# Set subuid and subgid
sudo touch /etc/subuid /etc/subgid
sudo chmod 644 /etc/subuid /etc/subgid
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER
# Rootless Podman
podman system migrate
fi
exit
if [[ ! -x $(command -v docker) ]]; then
$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 firewalld) ]]; then
$INSTALL firewalld
sudo systemctl enable firewalld
sudo systemctl start firewalld
fi
if [[ ! -x $(command -v vagrant) ]]; then
$INSTALL vagrant
vagrant plugin install vagrant-libvirt
fi
[[ ! -x $(command -v qemu-img) ]] && $INSTALL qemu # infra=( qemu qemu-utils qemu-efi qemu-kvm ) # ebtables
if [[ ! -x $(command -v virt-manager) ]]; then
VIRT=(libvirt bridge-utils virt-manager) #libvirt-clients libvirt-daemon-system virtinst
s_dolist "$INSTALL" "${VIRT[@]}"
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
sudo usermod -aG libvirt "$USER"
sudo usermod -aG kvm "$USER"
fi
if [[ ! -x $(command -v k3s) ]]; then
curl -sfL https://get.k3s.io | sh -
fi
[[ ! -x $(command -v kind) ]] && GO111MODULE=on go install sigs.k8s.io/[email protected]
if [[ ! -x $(command -v aws-iam-authenticator) ]]; then
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator -P "$HOME/.local/bin"
chmod +x "$HOME/.local/bin/aws-iam-authenticator"
fi
if [[ ! -x $(command -v eksctl) ]]; then
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
fi
if [[ ! -x $(command -v minikube) ]]; then
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo apt install ./minikube_latest_amd64.deb
fi
if [[ ! -x $(command -v jenkins) ]]; then
$UPDATE && $INSTALL fontconfig openjdk-11-jre jenkins
fi
[[ ! -x $(command -v virtualbox) ]] && $INSTALL virtualbox