1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-forgejo synced 2024-09-18 17:36:16 +00:00
setup-forgejo/forgejo-dependencies.sh

47 lines
1.2 KiB
Bash
Raw Normal View History

2023-03-25 16:36:27 +00:00
#!/bin/bash
2023-04-01 09:08:06 +00:00
# SPDX-License-Identifier: MIT
2023-03-25 16:36:27 +00:00
set -x
2023-03-29 22:27:54 +00:00
: ${LXC_IP_PREFIX:=10.0.8}
2023-03-25 18:14:55 +00:00
2023-03-25 16:36:27 +00:00
function install_docker() {
if ! systemctl is-active --quiet docker; then
echo deb http://deb.debian.org/debian bullseye-backports main | tee /etc/apt/sources.list.d/backports.list && apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --quiet -y -t bullseye-backports git docker.io
fi
}
function install_lxc() {
if ! systemctl is-active --quiet lxc-net; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y -qq make git libvirt0 libpam-cgfs bridge-utils uidmap dnsmasq-base dnsmasq dnsmasq-utils qemu-user-static
systemctl disable --now dnsmasq
apt-get install -y -qq lxc
systemctl stop lxc-net
2023-03-25 18:14:55 +00:00
cat >> /etc/default/lxc-net <<EOF
2023-03-29 22:27:54 +00:00
LXC_ADDR="$LXC_IP_PREFIX.1"
2023-03-25 16:36:27 +00:00
LXC_NETMASK="255.255.255.0"
2023-03-29 22:27:54 +00:00
LXC_NETWORK="$LXC_IP_PREFIX.0/24"
LXC_DHCP_RANGE="$LXC_IP_PREFIX.2,$LXC_IP_PREFIX.254"
2023-03-25 16:36:27 +00:00
LXC_DHCP_MAX="253"
EOF
systemctl start lxc-net
fi
}
function install_other() {
local packages="sudo"
if ! which $packages ; then
apt-get install -y -qq $packages
fi
}
function setup() {
install_other
2023-03-25 16:36:27 +00:00
install_docker
install_lxc
}
"${@:-setup}"