From: Zoltán Felleg Date: Thu, 15 Feb 2024 14:03:54 +0000 (+0100) Subject: Added log.in (renamed ls.in). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=bd5f69ebf5da3d1fb710964316a16ff0242f65f8;p=user-lxc.git Added log.in (renamed ls.in). --- diff --git a/sources/log.in/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/log.in/c3d/firstboot/scripts/01_setupnetworking.sh new file mode 100755 index 0000000..465c830 --- /dev/null +++ b/sources/log.in/c3d/firstboot/scripts/01_setupnetworking.sh @@ -0,0 +1,85 @@ +#!/bin/sh + + +export PAGER= + + +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 + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for NetworkManager" + 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 the two network connections to come up +CONNECTION_DEVICES_UP=$(nmcli --terse connection show \ + | grep --invert-match ':$' | wc -l) +CYCLES_WAITED=0 +while [ $CONNECTION_DEVICES_UP -lt 2 ] +do + if [ $CYCLES_WAITED -ge 10 ] + then + nmcli connection show + exit 1 + fi + if [ $CYCLES_WAITED -eq 0 ] + then + echo -n "Waiting for the network connection" + 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 2 ] +then + echo "Number of connections: $CONNECTIONS instead of 2" >&2 + exit 1 +fi + +CONNECTION_LINE=$(nmcli --terse connection show | grep ':eth0$') +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 internal \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ + ipv4.addresses "10.228.109.77/16" \ + ipv4.dns "10.228.109.159, 10.228.92.159" \ + ipv4.dns-search "in.useribm.hu" \ + ipv4.gateway "10.228.109.254" \ + ipv4.method "manual" \ + ipv6.addresses "2a02:d400:0000:f268:000c:18ff:fe03:6d4d/64" \ + ipv6.dns "2a02:d400:0000:f268:000c:18ff:fe03:6d9f, 2a02:d400:0000:f268:000c:18ff:fe03:5c9f" \ + ipv6.dns-search "in.useribm.hu" \ + ipv6.gateway "2a02:d400:0000:f268:000c:18ff:fe03:6dfe" \ + ipv6.method "manual" \ + save yes + +nmcli connection show + +hostnamectl hostname log.in.useribm.hu +hostnamectl diff --git a/sources/ls.in/c3d/firstboot/scripts/02_settimezone.sh b/sources/log.in/c3d/firstboot/scripts/02_settimezone.sh similarity index 100% rename from sources/ls.in/c3d/firstboot/scripts/02_settimezone.sh rename to sources/log.in/c3d/firstboot/scripts/02_settimezone.sh diff --git a/sources/ls.in/c3d/mode.txt b/sources/log.in/c3d/mode.txt similarity index 100% rename from sources/ls.in/c3d/mode.txt rename to sources/log.in/c3d/mode.txt diff --git a/sources/ls.in/c3d/postinstall/install-data/etc/logrotate.d/remote b/sources/log.in/c3d/postinstall/install-data/etc/logrotate.d/remote similarity index 83% rename from sources/ls.in/c3d/postinstall/install-data/etc/logrotate.d/remote rename to sources/log.in/c3d/postinstall/install-data/etc/logrotate.d/remote index 667fec8..7036540 100644 --- a/sources/ls.in/c3d/postinstall/install-data/etc/logrotate.d/remote +++ b/sources/log.in/c3d/postinstall/install-data/etc/logrotate.d/remote @@ -1,5 +1,4 @@ -/var/log/remote/everything.log -{ +/var/log/remote/*.log { rotate -1 daily missingok diff --git a/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf b/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf new file mode 100644 index 0000000..dc14500 --- /dev/null +++ b/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf @@ -0,0 +1,15 @@ +template(name="remoteTemplate" type="list") { + constant(value="/var/log/remote/") + property(name="hostname") + constant(value=".log") +} + +module(load="imtcp") +module(load="imudp") + +ruleset(name="remoteRuleset"){ + *.* action(type="omfile" DynaFile="remoteTemplate") +} + +input(type="imtcp" port="514" ruleset="remoteRuleset") +input(type="imudp" port="514" ruleset="remoteRuleset") diff --git a/sources/ls.in/c3d/postinstall/scripts/10_setupservices.sh b/sources/log.in/c3d/postinstall/scripts/10_setupservices.sh similarity index 100% rename from sources/ls.in/c3d/postinstall/scripts/10_setupservices.sh rename to sources/log.in/c3d/postinstall/scripts/10_setupservices.sh diff --git a/sources/ls.in/config b/sources/log.in/config similarity index 94% rename from sources/ls.in/config rename to sources/log.in/config index 4d1aa5a..a8d474d 100644 --- a/sources/ls.in/config +++ b/sources/log.in/config @@ -10,7 +10,7 @@ lxc.mount.entry = __CONTAINER_FILESYSTEMS_PATH__ var/log/remote none bind,create lxc.net.0.type = veth lxc.net.0.flags = up lxc.net.0.link = brci-dev -lxc.net.0.hwaddr = 02:0c:18:03:6d:8b +lxc.net.0.hwaddr = 02:0c:18:03:6d:4d lxc.autodev = 1 diff --git a/sources/ls.in/envvars b/sources/log.in/envvars similarity index 100% rename from sources/ls.in/envvars rename to sources/log.in/envvars diff --git a/sources/ls.in/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/ls.in/c3d/firstboot/scripts/01_setupnetworking.sh deleted file mode 100755 index 25aa683..0000000 --- a/sources/ls.in/c3d/firstboot/scripts/01_setupnetworking.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - - -export PAGER= - - -sleep 1 -systemctl --quiet is-active NetworkManager.service -NM_RC=$? -WAITED=0 -while [ $NM_RC -ne 0 ] -do - echo -n . - sleep 1 - WAITED=1 - systemctl --quiet is-active NetworkManager.service - NM_RC=$? -done -[ $WAITED -eq 1 ] && echo - -CONNECTIONS=$(nmcli --terse connection show | wc -l) -while [ $CONNECTIONS -ne 1 ] -do - echo "Number of connections: $CONNECTIONS" >&2 - sleep 1 - CONNECTIONS=$(nmcli --terse connection show | wc -l) -done - -nmcli --terse connection show | grep ':$' >/dev/null -ALL_CONNECTION_DEVICES_KNOWN=$? -while [ $ALL_CONNECTION_DEVICES_KNOWN -eq 0 ] -do - echo "Not all connection devices are known yet" >&2 - sleep 1 - nmcli --terse connection show | grep ':$' >/dev/null - ALL_CONNECTION_DEVICES_KNOWN=$? -done - -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 add \ - connection.autoconnect yes \ - connection.id internal \ - connection.interface-name $CONNECTION_DEVICE \ - connection.type 802-3-ethernet \ - ipv4.addresses "10.228.109.139/16" \ - ipv4.dns "10.228.109.159, 10.228.92.159" \ - ipv4.dns-search "in.useribm.hu" \ - ipv4.gateway "10.228.109.254" \ - ipv4.method "manual" \ - ipv6.addresses "2a02:d400:0000:f268:000c:18ff:fe03:6d8b/64" \ - ipv6.dns "2a02:d400:0000:f268:000c:18ff:fe03:6d9f, 2a02:d400:0000:f268:000c:18ff:fe03:5c9f" \ - ipv6.dns-search "in.useribm.hu" \ - ipv6.gateway "2a02:d400:0000:f268:000c:18ff:fe03:6dfe" \ - ipv6.method "manual" \ - save yes - -nmcli connection delete uuid "$CONNECTION_UUID" - -nmcli connection show diff --git a/sources/ls.in/c3d/postinstall/scripts/20_setuprsyslog.sh b/sources/ls.in/c3d/postinstall/scripts/20_setuprsyslog.sh deleted file mode 100755 index e152c51..0000000 --- a/sources/ls.in/c3d/postinstall/scripts/20_setuprsyslog.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - - -sed --in-place=.orig \ - -e 's/^#module(load="imudp")/module(load="imudp")/' \ - -e 's/^#input(type="imudp" port="514")/input(type="imudp" port="514")/' \ - -e 's/^#module(load="imtcp")/module(load="imtcp")/' \ - -e 's/^#input(type="imtcp" port="514")/input(type="imtcp" port="514")/' \ - /etc/rsyslog.conf - -echo >>/etc/rsyslog.conf -echo "*.* /var/log/remote/everything.log" >>/etc/rsyslog.conf