#1526 PR merged: Split network-functions.sh into DHCP setup and general ReaR functions

Labels: enhancement, cleanup, fixed / solved / done

jsmeix opened issue at 2017-10-05 16:11:

See https://github.com/rear/rear/issues/1517

Now usr/share/rear/lib/network-functions.sh contains only
those functions (and dependantfunctions and variabes)
that are called by the usual ReaR scripts and all
what is needed for DHCP setup in the recovery system
by the recovery system startup scripts in
usr/share/rear/skel/default is split from network-functions.sh
into the new skel/default/etc/scripts/dhcp-setup-functions.sh
that is sourced by skel/default/bin/dhclient-script
and skel/default/etc/scripts/system-setup.d/58-start-dhclient.sh

For me a quick test via "rear mkrescue"
and "rear recover" still worked
but that does not mean very much.

I still get the 'MASKS readonly variable'
reported during recovery system startup
cf. https://github.com/rear/rear/issues/1524
because the 'MASKS readonly variable' is
both left in lib/network-functions.sh and in the
new skel/default/etc/scripts/dhcp-setup-functions.sh
which are both sourced - I will fix that later.

jsmeix commented at 2017-10-05 16:12:

@gdha @schabrolles please have a look
if you find immediate issues with that.

jsmeix commented at 2017-10-06 13:14:

@gozora please have a look because of
https://github.com/rear/rear/commit/a93c1df3ae5118be28cf0f3677900efbdae9c601#commitcomment-24806205

jsmeix commented at 2017-10-06 13:23:

I renamed MASKS into NETMASKS in dhcp-setup-functions.sh
and into NETMASKS_DECIMAL in network-functions.sh and
both without 'readonly' as a quick fix to avoid
https://github.com/rear/rear/issues/1524
because there are zillions of things in ReaR that should
better not be arbitrarily overwritten without being 'readonly'
so that - at least for now - one more should not really matter.

I also overhauled the remaining old functions in
usr/share/rear/lib/network-functions.sh.

Now "rear mkrescue" plus "rear recover"
works well for me without 'readonly variable' messages.

gozora commented at 2017-10-06 13:40:

Hello @jsmeix,

I've just add LANG=C back because it was present in original code. I don't have explicit knowledge what is it good for :-(, I just didn't want to break anything.

Searching the code, this function was introduced by 38d5bd280654dd4e05a8a408daad8e08925c3ab0 authored by @gdha so maybe he know more ...

V.

jsmeix commented at 2017-10-06 13:57:

As far as I see that 'LANG=C' exists also originally
in that old fedora-14 dhclient-script which is now mostly in
skel/default/etc/scripts/dhcp-setup-functions.sh
where I kept is as is (as some other 'LANG' stuff too).
I think in lib/network-functions.sh it is really not needed.

jsmeix commented at 2017-10-09 12:07:

If there are no strict objections I will merge it tomorrow
so that we have at least a first step to further proceed.


[Export of Github issue for rear/rear.]