mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-27 08:40:57 -05:00
43 lines
1.1 KiB
Bash
Executable file
43 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
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
|
|
cat >> /etc/default/lxc-net <<'EOF'
|
|
LXC_ADDR="10.0.8.1"
|
|
LXC_NETMASK="255.255.255.0"
|
|
LXC_NETWORK="10.0.8.0/24"
|
|
LXC_DHCP_RANGE="10.0.8.2,10.0.8.254"
|
|
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
|
|
install_docker
|
|
install_lxc
|
|
}
|
|
|
|
setup
|