reorganize dependencies installation

This commit is contained in:
Earl Warren 2023-03-25 17:36:27 +01:00
parent e39c635a02
commit e716e12a71
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 48 additions and 38 deletions

View file

@ -6,8 +6,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: | - run: |
set -x set -x
./lxc.sh ./dependencies.sh
./docker.sh
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19 ./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo:1.19
./forgejo-runner.sh setup ./forgejo-runner.sh setup
# testdata/run.sh workflow http://root:admin1234@$(cat forgejo-ip):3000 root demo # testdata/run.sh workflow http://root:admin1234@$(cat forgejo-ip):3000 root demo

43
dependencies.sh Executable file
View file

@ -0,0 +1,43 @@
#!/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.7.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.7.0/24"
LXC_DHCP_RANGE="10.0.7.2,10.0.7.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_docker
install_lxc
install_other
}
setup

View file

@ -1,12 +0,0 @@
#!/bin/bash
set -x
setup() {
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
}
setup

23
lxc.sh
View file

@ -1,23 +0,0 @@
#!/bin/bash
set -x
setup() {
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.7.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.7.0/24"
LXC_DHCP_RANGE="10.0.7.2,10.0.7.254"
LXC_DHCP_MAX="253"
EOF
systemctl start lxc-net
fi
}
setup

5
testdata/run.sh vendored
View file

@ -31,7 +31,10 @@ function wait_success() {
fi fi
sleep 1 sleep 1
done done
test "$(check_status "$forgejo" "$repo" "$sha")" = "success" if ! test "$(check_status "$forgejo" "$repo" "$sha")" = "success" ; then
cat forgejo-runner.log
return 1
fi
} }
function push() { function push() {