diff options
Diffstat (limited to 'core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx')
-rwxr-xr-x | core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index c034efb5..b2a4e896 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -155,10 +155,13 @@ case "$1" in rebuild_resolv_conf fi - + # NOTE: The udev rule triggering our network setup is changed in *installer* + # to only trigger this script on additional interfaces bridges. Keeping the code + # here for now and for easier merging... # Things that should only happen for the main interface that was used for booting if [ "$interface" = "$primary" ]; then - # Update IP + # Update IP, TODO: check if we really want/need to overwrite the PXE_IP, + # it might be better/clearer to change the SLX_DHCP_CLIENT_IP... sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config # Write DOMAIN and SEARCH to /opt/openslx/config if empty if [ -z "$SLX_NET_DOMAIN" ] && [ -n "$domain" ]; then @@ -175,36 +178,6 @@ case "$1" in echo "SLX_NET_WINS='$wins'" >> /opt/openslx/config fi - # Only if network is not ready yet - if ! [ -e "/run/network/network-ready" ] || ! [ -e "/etc/hostname" ] || grep -q '^noname-' "/etc/hostname"; then - # Update hostname - if [ -z "$dns_fqdn" ] && [ -n "$domain" ] && [ -n "$hostname" ]; then - # fallback to what the dhcp told us - dns_fqdn="${hostname}.${domain}" - fi - if [ -z "$dns_fqdn" ]; then - # only if there is no /etc/hostname, we fall back (far back, that is) - [ ! -s "/etc/hostname" ] && dns_fqdn="slx-client" - fi - # finally, if dns_fqdn was set to anything, apply it - if [ -n "$dns_fqdn" ]; then - dns_short="${dns_fqdn%%.*}" - echo "$dns_short" > "/proc/sys/kernel/hostname" - echo "$dns_short" > "/etc/hostname" - if grep '^SLX_HOSTNAME=' /opt/openslx/config 2>/dev/null; then - sed -i "s/^\(SLX_HOSTNAME=\).*$/\1'$dns_short'/" /opt/openslx/config - else - echo "# Config written by openslx-dhcp-script (1)" >> /opt/openslx/config - echo "SLX_HOSTNAME='$dns_short'" >> /opt/openslx/config - fi - fi - - # Update /etc/issue for proper spacing - /opt/openslx/scripts/openslx-create_issue - touch "/run/network/network-ready" - # Mark network target as reached - systemctl start network.target & - fi # end "network not ready yet" # Remove any stray addresses; we expect the primary interface to only have one # address supplied via DHCP. We do this after adding the new one, obviously. rem_list=$( ip -o addr show "$interface" | awk '{ for (i=1;i<NF;++i) if ($i == "inet") print $(i+1) }' | grep -v "^${ip}/" ) @@ -217,7 +190,7 @@ case "$1" in done fi fi # end "primary only" - + # Hostname in /etc/hosts touch "/etc/hosts" hostlist="" @@ -238,20 +211,10 @@ case "$1" in fi # Get rid of orphaned lines in /etc/hosts sed -i -r '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/d' /etc/hosts - - # "dns ready" target - if [ -n "$dns" ] && [ ! -e "/run/network/dns-ready" ]; then - touch "/run/network/dns-ready" - # Write to openslx-config - echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config - echo "SLX_DNS='$dns'" >> /opt/openslx/config - systemctl start network-dns.target & - fi - # "default route exists" target - if [ -n "$router" ] && [ ! -e "/run/network/gateway-ready" ]; then - touch "/run/network/gateway-ready" - systemctl start network-gateway.target & - fi + # Write to openslx-config + echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config + sed -i "/^SLX_DNS=/d" /opt/openslx/config + echo "SLX_DNS='$dns'" >> /opt/openslx/config ;; deconfig) |