Added log.in (renamed ls.in).
authorZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Thu, 15 Feb 2024 14:03:54 +0000 (15:03 +0100)
committerZoltán Felleg <zoltan.felleg@userrendszerhaz.hu>
Thu, 15 Feb 2024 14:03:54 +0000 (15:03 +0100)
sources/log.in/c3d/firstboot/scripts/01_setupnetworking.sh [new file with mode: 0755]
sources/log.in/c3d/firstboot/scripts/02_settimezone.sh [moved from sources/ls.in/c3d/firstboot/scripts/02_settimezone.sh with 100% similarity]
sources/log.in/c3d/mode.txt [moved from sources/ls.in/c3d/mode.txt with 100% similarity]
sources/log.in/c3d/postinstall/install-data/etc/logrotate.d/remote [moved from sources/ls.in/c3d/postinstall/install-data/etc/logrotate.d/remote with 83% similarity]
sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf [new file with mode: 0644]
sources/log.in/c3d/postinstall/scripts/10_setupservices.sh [moved from sources/ls.in/c3d/postinstall/scripts/10_setupservices.sh with 100% similarity]
sources/log.in/config [moved from sources/ls.in/config with 94% similarity]
sources/log.in/envvars [moved from sources/ls.in/envvars with 100% similarity]
sources/ls.in/c3d/firstboot/scripts/01_setupnetworking.sh [deleted file]
sources/ls.in/c3d/postinstall/scripts/20_setuprsyslog.sh [deleted file]

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 (executable)
index 0000000..465c830
--- /dev/null
@@ -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
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 667fec8b185156b76e066fb7266a2e657af6bcca..703654014fbf660fa909b2cbf1f251f187001a09 100644 (file)
@@ -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 (file)
index 0000000..dc14500
--- /dev/null
@@ -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")
similarity index 94%
rename from sources/ls.in/config
rename to sources/log.in/config
index 4d1aa5a303bb6bf3eaffd7c1d46ebe5d4ca9ccd5..a8d474d3c9d57073a1d280dd5edbc34d60737d3f 100644 (file)
@@ -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
 
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 (executable)
index 25aa683..0000000
+++ /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 (executable)
index e152c51..0000000
+++ /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