blob: 43880b95e57e1d63acb3a5a0f54f644d666c3717 (
plain)
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
|
#!/bin/bash
test "${EUID}" -ne 0 && printf "%s\n" "run as root" && exit 1
if ! command -v apt-get &>/dev/null; then
printf "%s\n" "[err] distribution not debian-based"
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
export NEEDRESTART_SUSPEND=1
apt-get update
apt-get install -y \
curl ca-certificates gpg lsb-release \
lsb-release xorriso qemu-system-x86
curl -sSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
printf "%s" "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
apt-get update
apt-get install -y packer
hash -r
plugins=$(packer plugins installed)
if ! printf "%s\n" "${plugins}" | grep -qi qemu; then
packer plugins install github.com/hashicorp/qemu
printf "%s\n" "[inf] installed packer qemu plugin"
else
printf "%s\n" "[inf] packer qemu plugin already installed"
fi
curl -fsSL https://get.docker.com | bash
|