mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 01:20:56 -05:00
DRY: re-use lxc-helpers
This commit is contained in:
parent
178b7fa387
commit
7bb4ff5671
1 changed files with 5 additions and 22 deletions
|
@ -3,35 +3,18 @@
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
source $(dirname $0)/lxc-helpers/enough-lxc-helpers.sh
|
||||||
|
|
||||||
: ${LXC_IP_PREFIX:=10.0.8}
|
: ${LXC_IP_PREFIX:=10.0.8}
|
||||||
|
|
||||||
function install_docker() {
|
function install_docker() {
|
||||||
if ! systemctl is-active --quiet docker; then
|
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
|
lxc_install_docker_inside
|
||||||
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="$LXC_IP_PREFIX.1"
|
|
||||||
LXC_NETMASK="255.255.255.0"
|
|
||||||
LXC_NETWORK="$LXC_IP_PREFIX.0/24"
|
|
||||||
LXC_DHCP_RANGE="$LXC_IP_PREFIX.2,$LXC_IP_PREFIX.254"
|
|
||||||
LXC_DHCP_MAX="253"
|
|
||||||
EOF
|
|
||||||
systemctl start lxc-net
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_other() {
|
function install_other() {
|
||||||
local packages="sudo"
|
local packages="sudo git"
|
||||||
if ! which $packages ; then
|
if ! which $packages ; then
|
||||||
apt-get install -y -qq $packages
|
apt-get install -y -qq $packages
|
||||||
fi
|
fi
|
||||||
|
@ -40,7 +23,7 @@ function install_other() {
|
||||||
function setup() {
|
function setup() {
|
||||||
install_other
|
install_other
|
||||||
install_docker
|
install_docker
|
||||||
install_lxc
|
lxc_install_lxc_inside $LXC_IP_PREFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
"${@:-setup}"
|
"${@:-setup}"
|
||||||
|
|
Loading…
Reference in a new issue