From cd268778f7e1171a0bbb7e3c8aa43aa8ee60ba00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Mon, 7 Mar 2022 14:50:02 +0100 Subject: [PATCH] Added git.pm. --- .../firstboot/scripts/01_setupnetworking.sh | 73 +++++++++++++++++++ .../c3d/firstboot/scripts/02_settimezone.sh | 21 ++++++ .../c3d/firstboot/scripts/90_setupservices.sh | 10 +++ sources/git.pm/c3d/mode.txt | 3 + .../install-data/etc/httpd/conf.d/git.conf | 29 ++++++++ .../postinstall/scripts/10_setupservices.sh | 7 ++ sources/git.pm/config | 22 ++++++ sources/git.pm/envvars | 3 + sources/start-order.txt | 9 ++- 9 files changed, 175 insertions(+), 2 deletions(-) create mode 100755 sources/git.pm/c3d/firstboot/scripts/01_setupnetworking.sh create mode 100755 sources/git.pm/c3d/firstboot/scripts/02_settimezone.sh create mode 100755 sources/git.pm/c3d/firstboot/scripts/90_setupservices.sh create mode 100644 sources/git.pm/c3d/mode.txt create mode 100644 sources/git.pm/c3d/postinstall/install-data/etc/httpd/conf.d/git.conf create mode 100755 sources/git.pm/c3d/postinstall/scripts/10_setupservices.sh create mode 100644 sources/git.pm/config create mode 100644 sources/git.pm/envvars diff --git a/sources/git.pm/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/git.pm/c3d/firstboot/scripts/01_setupnetworking.sh new file mode 100755 index 0000000..701a5a5 --- /dev/null +++ b/sources/git.pm/c3d/firstboot/scripts/01_setupnetworking.sh @@ -0,0 +1,73 @@ +#!/bin/sh + + +sleep 1 +systemctl --quiet is-active NetworkManager.service +NM_RC=$? +CYCLES_WAITED=0 +while [ $NM_RC -ne 0 ] +do + if [ $CYCLES_WAITED -ge 10 ] + then + exit 1 + fi + echo -n . + sleep 1 + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) + systemctl --quiet is-active NetworkManager.service + NM_RC=$? +done +[ $CYCLES_WAITED -gt 0 ] && echo + +# wait for one/the network connection to come up +CONNECTION_DEVICES_UP=$(nmcli --terse connection show \ + | grep --invert-match ':$' | wc -l) +CYCLES_WAITED=0 +while [ $CONNECTION_DEVICES_UP -lt 1 ] +do + if [ $CYCLES_WAITED -ge 10 ] + then + nmcli connection show + exit 1 + fi + echo -n . + sleep 1 + CYCLES_WAITED=$(( $CYCLES_WAITED + 1 )) + CONNECTION_DEVICES_UP=$(nmcli --terse connection show \ + | grep --invert-match ':$' | wc -l) +done +[ $CYCLES_WAITED -gt 0 ] && echo + +CONNECTIONS=$(nmcli --terse connection show | wc -l) +if [ $CONNECTIONS -ne 1 ] +then + echo "Number of connections: $CONNECTIONS" >&2 + exit 1 +fi + +CONNECTION_LINE=$(nmcli --terse connection show) +CONNECTION_UUID=$(echo $CONNECTION_LINE | cut -f 2 -d ':') +CONNECTION_DEVICE=$(echo $CONNECTION_LINE | cut -f 4 -d ':') + +nmcli connection delete uuid "$CONNECTION_UUID" + +nmcli connection add \ + connection.autoconnect yes \ + connection.id perimeter \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ + ipv4.addresses "192.168.173.79/24" \ + ipv4.dns "192.168.173.174" \ + ipv4.dns-search "pm.useribm.hu" \ + ipv4.gateway "192.168.173.254" \ + ipv4.method "manual" \ + ipv4.routes "10.228.0.0/16 192.168.173.1" \ + ipv6.addresses "2a02:d400:0000:f2ad:000c:18ff:fe03:ad4f/64" \ + ipv6.dns "2a02:d400:0000:f2ad:000c:18ff:fe03:adae" \ + ipv6.dns-search "pm.useribm.hu" \ + ipv6.gateway "2a02:d400:0000:f2ad:000c:18ff:fe03:adfe" \ + ipv6.routes "2a02:d400:0000:f268::/64 2a02:d400:0000:f2ad:000c:18ff:fe03:ad01" \ + ipv6.method "manual" \ + save yes + +nmcli connection show diff --git a/sources/git.pm/c3d/firstboot/scripts/02_settimezone.sh b/sources/git.pm/c3d/firstboot/scripts/02_settimezone.sh new file mode 100755 index 0000000..20b2a71 --- /dev/null +++ b/sources/git.pm/c3d/firstboot/scripts/02_settimezone.sh @@ -0,0 +1,21 @@ +#!/bin/sh + + +sleep 1 +systemctl --quiet is-active dbus.service +DBUS_RC=$? +WAITED=0 +while [ $DBUS_RC -ne 0 ] +do + if [ $WAITED -eq 0 ] + then + echo -n "Waiting for dbus.service" + fi + echo -n . + sleep 1 + WAITED=1 + systemctl --quiet is-active dbus.service + DBUS_RC=$? +done +[ $WAITED -ne 0 ] && echo +timedatectl set-timezone Europe/Budapest diff --git a/sources/git.pm/c3d/firstboot/scripts/90_setupservices.sh b/sources/git.pm/c3d/firstboot/scripts/90_setupservices.sh new file mode 100755 index 0000000..c8815a0 --- /dev/null +++ b/sources/git.pm/c3d/firstboot/scripts/90_setupservices.sh @@ -0,0 +1,10 @@ +#!/bin/sh + + +systemctl enable httpd.service +systemctl start httpd.service +systemctl enable NetworkManager-wait-online.service +systemctl start NetworkManager-wait-online.service + +systemctl enable logrotate.timer +systemctl start logrotate.timer diff --git a/sources/git.pm/c3d/mode.txt b/sources/git.pm/c3d/mode.txt new file mode 100644 index 0000000..d0ff0b1 --- /dev/null +++ b/sources/git.pm/c3d/mode.txt @@ -0,0 +1,3 @@ +# mode file (relative to /c3d) +755 firstboot/scripts/*.sh +755 postinstall/scripts/*.sh diff --git a/sources/git.pm/c3d/postinstall/install-data/etc/httpd/conf.d/git.conf b/sources/git.pm/c3d/postinstall/install-data/etc/httpd/conf.d/git.conf new file mode 100644 index 0000000..d8bd2bd --- /dev/null +++ b/sources/git.pm/c3d/postinstall/install-data/etc/httpd/conf.d/git.conf @@ -0,0 +1,29 @@ + + ServerName git.pm.useribm.hu + ServerAdmin siteadmin@useribm.hu + + SetEnv GIT_PROJECT_ROOT /git + SetEnv GIT_HTTP_EXPORT_ALL + + DocumentRoot /git + ScriptAlias / /usr/libexec/git-core/git-http-backend/ + + + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + AllowOverride None + Require all granted + + + + AuthName "Git" + AuthType Digest + AuthDigestProvider file + AuthUserFile /git/auth.htdigest + Require valid-user + + Dav On + Options Indexes FollowSymLinks + AllowOverride None + Require all granted + + diff --git a/sources/git.pm/c3d/postinstall/scripts/10_setupservices.sh b/sources/git.pm/c3d/postinstall/scripts/10_setupservices.sh new file mode 100755 index 0000000..4cec25f --- /dev/null +++ b/sources/git.pm/c3d/postinstall/scripts/10_setupservices.sh @@ -0,0 +1,7 @@ +#!/bin/sh + + +systemctl disable httpd.service +systemctl disable NetworkManager-wait-online.service + +systemctl disable logrotate.timer diff --git a/sources/git.pm/config b/sources/git.pm/config new file mode 100644 index 0000000..aad5606 --- /dev/null +++ b/sources/git.pm/config @@ -0,0 +1,22 @@ +lxc.include = /usr/share/lxc/config/common.conf + +lxc.arch = x86_64 +lxc.uts.name = git.pm.useribm.hu +lxc.rootfs.path = __CONTAINER_PATH__/rootfs +lxc.mount.auto = proc:rw sys:ro +lxc.mount.entry = __CONTAINER_FILESYSTEMS_PATH__ git none bind,create=dir 0 0 + +lxc.net.0.type = veth +lxc.net.0.flags = up +lxc.net.0.link = brch-dev +lxc.net.0.hwaddr = 02:0c:18:03:ad:4f + +lxc.autodev = 1 + +lxc.cgroup2.devices.allow = a + +lxc.signal.halt = SIGRTMIN+4 + +lxc.start.auto = 1 +lxc.start.order = __CONTAINER_START_ORDER__ +lxc.start.delay = 5 diff --git a/sources/git.pm/envvars b/sources/git.pm/envvars new file mode 100644 index 0000000..30a7bb0 --- /dev/null +++ b/sources/git.pm/envvars @@ -0,0 +1,3 @@ +DISTRIBUTION=Fedora +DISTRIBUTION_VERSION=35 +SPEC_PACKAGES="cronie git-all httpd" diff --git a/sources/start-order.txt b/sources/start-order.txt index 8a9343c..a144514 100644 --- a/sources/start-order.txt +++ b/sources/start-order.txt @@ -30,5 +30,10 @@ group 6: wiki.in 55 group 7: - dhsvn.in 61 - pastry.in 62 + git.pm 61 + hg.pm 62 + svn.pm 63 + +group 8: + dhsvn.in 71 + pastry.in 72 -- 2.54.0