From: Zoltán Felleg Date: Wed, 19 Apr 2023 07:45:43 +0000 (+0200) Subject: Updated xfr.pm (converted to the new c3d format, updated to Fedora 38). X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=5fa6639e47d1fd5891ff8ee4b5f0a761b41e01bd;p=user-lxc.git Updated xfr.pm (converted to the new c3d format, updated to Fedora 38). --- diff --git a/sources/xfr.pm/c3d/firstboot/scripts/01_setupnetworking.sh b/sources/xfr.pm/c3d/firstboot/scripts/01_setupnetworking.sh new file mode 100755 index 0000000..8fc291d --- /dev/null +++ b/sources/xfr.pm/c3d/firstboot/scripts/01_setupnetworking.sh @@ -0,0 +1,81 @@ +#!/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 perimeter \ + connection.interface-name $CONNECTION_DEVICE \ + connection.type 802-3-ethernet \ + ipv4.addresses "192.168.173.251/24" \ + ipv4.dns "192.168.173.174" \ + ipv4.dns-search "pm.user.hu" \ + ipv4.gateway "192.168.173.254" \ + ipv4.method "manual" \ + ipv6.method "auto" \ + save yes + +nmcli connection show + +hostnamectl hostname xfr.pm.useribm.hu +hostnamectl diff --git a/sources/xfr.pm/firstboot/02_settimezone.sh b/sources/xfr.pm/c3d/firstboot/scripts/02_settimezone.sh similarity index 100% rename from sources/xfr.pm/firstboot/02_settimezone.sh rename to sources/xfr.pm/c3d/firstboot/scripts/02_settimezone.sh diff --git a/sources/xfr.pm/firstboot/03_setupldap.sh b/sources/xfr.pm/c3d/firstboot/scripts/03_setupldap.sh similarity index 100% rename from sources/xfr.pm/firstboot/03_setupldap.sh rename to sources/xfr.pm/c3d/firstboot/scripts/03_setupldap.sh diff --git a/sources/xfr.pm/firstboot/99_cleanup.sh b/sources/xfr.pm/c3d/firstboot/scripts/99_cleanup.sh similarity index 100% rename from sources/xfr.pm/firstboot/99_cleanup.sh rename to sources/xfr.pm/c3d/firstboot/scripts/99_cleanup.sh diff --git a/sources/xfr.pm/c3d/mode.txt b/sources/xfr.pm/c3d/mode.txt new file mode 100644 index 0000000..9b8459e --- /dev/null +++ b/sources/xfr.pm/c3d/mode.txt @@ -0,0 +1,4 @@ +# mode file (relative to /c3d) +755 firstboot/scripts/*.sh +755 postinstall/install-data/usr/local/bin/* +755 postinstall/scripts/*.sh diff --git a/sources/xfr.pm/postinstall/install/etc/httpd/conf.d/xfr.80.conf b/sources/xfr.pm/c3d/postinstall/install-data/etc/httpd/conf.d/xfr.80.conf similarity index 100% rename from sources/xfr.pm/postinstall/install/etc/httpd/conf.d/xfr.80.conf rename to sources/xfr.pm/c3d/postinstall/install-data/etc/httpd/conf.d/xfr.80.conf diff --git a/sources/xfr.pm/postinstall/01_setownership.sh b/sources/xfr.pm/c3d/postinstall/scripts/01_setownership.sh similarity index 100% rename from sources/xfr.pm/postinstall/01_setownership.sh rename to sources/xfr.pm/c3d/postinstall/scripts/01_setownership.sh diff --git a/sources/xfr.pm/postinstall/02_setpermissions.sh b/sources/xfr.pm/c3d/postinstall/scripts/02_setpermissions.sh similarity index 100% rename from sources/xfr.pm/postinstall/02_setpermissions.sh rename to sources/xfr.pm/c3d/postinstall/scripts/02_setpermissions.sh diff --git a/sources/xfr.pm/postinstall/03_installfiles.sh b/sources/xfr.pm/c3d/postinstall/scripts/03_installfiles.sh similarity index 100% rename from sources/xfr.pm/postinstall/03_installfiles.sh rename to sources/xfr.pm/c3d/postinstall/scripts/03_installfiles.sh diff --git a/sources/xfr.pm/postinstall/10_setupservices.sh b/sources/xfr.pm/c3d/postinstall/scripts/10_setupservices.sh similarity index 100% rename from sources/xfr.pm/postinstall/10_setupservices.sh rename to sources/xfr.pm/c3d/postinstall/scripts/10_setupservices.sh diff --git a/sources/xfr.pm/postinstall/99_cleanup.sh b/sources/xfr.pm/c3d/postinstall/scripts/99_cleanup.sh similarity index 100% rename from sources/xfr.pm/postinstall/99_cleanup.sh rename to sources/xfr.pm/c3d/postinstall/scripts/99_cleanup.sh diff --git a/sources/xfr.pm/envvars b/sources/xfr.pm/envvars index c11d08c..88e4883 100644 --- a/sources/xfr.pm/envvars +++ b/sources/xfr.pm/envvars @@ -1,5 +1,5 @@ DISTRIBUTION=Fedora -DISTRIBUTION_VERSION=37 +DISTRIBUTION_VERSION=38 ROOT_PACKAGES="hostname initscripts iproute rootfiles systemd-udev" BASE_PACKAGES="NetworkManager iputils logrotate rsyslog tar vim-minimal" SPEC_PACKAGES="httpd mod_wsgi" diff --git a/sources/xfr.pm/firstboot/01_setupnetworking.sh b/sources/xfr.pm/firstboot/01_setupnetworking.sh deleted file mode 100755 index e76a2b3..0000000 --- a/sources/xfr.pm/firstboot/01_setupnetworking.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - - -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 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.251/24" \ - ipv4.dns "192.168.173.174" \ - ipv4.dns-search "pm.user.hu" \ - ipv4.gateway "192.168.173.254" \ - ipv4.method "manual" \ - ipv6.method "auto" \ - save yes - -nmcli connection show