Commit Graph

71 Commits (052)

Author SHA1 Message Date
Jan Macku cb86c560b0 Write dns values passed by ip argument to ifcfg-* files 2020-01-14 09:33:38 +01:00
Böszörményi Zoltán a01204202b Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced.

dracutsysrootdir is the root directory, file existence checks use it.

DRACUT_LDCONFIG can override ldconfig with a different one that works
on the sysroot with foreign binaries.

DRACUT_LDD can override ldd with a different one that works
with foreign binaries.

DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
may use symlinks that are valid only when running on the target
so a real file must be provided that exist in the sysroot.

DRACUT_INSTALL now supports debugging dracut-install in itself
when run by dracut but without debugging the dracut scripts.
E.g. DRACUT_INSTALL="valgrind dracut-install or
DRACUT_INSTALL="dracut-install --debug".

DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA,
DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ,
DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4,
DRACUT_COMPRESS_CAT: All of the compression utilities may be
overridden, to support the native binaries in non-standard places.

DRACUT_ARCH overrides "uname -m".

SYSTEMD_VERSION overrides "systemd --version".

The dracut-install utility was overhauled to support sysroot via
a new option -r and fixes for clang-analyze. It supports
cross-compiler-ldd from
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

DRACUT_INSTALL_PATH was introduced so dracut-install can work with
a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
points to natively built binaries that are not in the host's /bin,
/usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
that are relative to the cross-compiled sysroot.

The hashmap pool allocate_tile/deallocate_tile code was removed
because clang-analyze showed errors in it. hashmap_copy was removed
because it wasn't used and clang-analyze showed errors in it.

DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were
introduced so dracut-install can use different settings from
DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Harald Hoyer 22c8a5c73f
Do not sort the resulting /run/initramfs/state/etc/resolv.conf
nameserver priorities should be preserved

Resolves: https://github.com/dracutdevs/dracut/issues/652
2019-10-21 11:50:20 +02:00
Harald Hoyer ee18dd2b88 ifcfg/write-ifcfg.sh: aggregate resolv.conf
The old code used /tmp/net.$netif.resolv.conf with $netif being randomly
chosen.

As it is not known which nameserver have which priority, just sort them
and deduplicate.
2018-08-17 15:52:36 +02:00
Harald Hoyer 041e49ee2a network: enhance team support
Install ifcfg-* files with team configuration in the initramfs.

Improve the slave configuration of the team interface, by looking up
ifcfg files in the initramfs.

Create a default loadbalance team config, if none present in the
initramfs.

forward port of
4c88c2859e
2017-03-30 11:50:35 +02:00
Lukas Nykryn 196bb03477 write-ifcfg: do't write MTU twice for regular eth devices
If MTU is specified, we write it for every type of device in the
beginning. There is not point writing it again for Type=ethernet
devices.
2017-03-01 14:46:12 +01:00
Harald Hoyer 043d8f401b ifcfg/write-ifcfg.sh: write DEVICE=$netif for VLAN
VLAN interface configuration is not bound by HWADDR but by DEVICE
2017-01-18 16:23:45 +01:00
Harald Hoyer e7838a8312 network: fixup VLAN handling 2017-01-18 15:16:01 +01:00
Harald Hoyer 0cf826a11a network: fix vlan handling 2017-01-18 13:28:47 +01:00
Harald Hoyer 24a78b2697 Fixed vlan, bonding, bridging, team logic
Call ifup for the slaves and assemble afterwards.
2016-01-19 11:35:23 +01:00
Mike Gilbert 5899f2f516 Replace echo -n with printf in code with a /bin/sh shebang
POSIX does not mandate that echo support the -n parameter.
printf has more well-defined behavior.
2015-07-14 22:22:14 -04:00
Harald Hoyer 6d58fa27a4 change "while read x" to cope with EOF without newline
while read x || [ -n "$x" ]

should do the trick
2015-04-28 11:39:15 +02:00
Harald Hoyer 23446ef1e0 ifcfg/write-ifcfg.sh: unset vlan
clear the vlan flag, if a previous interface in the loop
was a vlan interface
2015-04-21 15:10:49 +02:00
Harald Hoyer 3947f07d93 ifcfg/write-ifcfg: only write DEVICE for non-kernel names
Rename an interface to the kernel namespace is not allowed, so don't add
DEVICE="<iface>", if HWADDR is given.
2014-10-28 15:13:35 +01:00
Harald Hoyer 80043e21c1 ifcfg/write-ifcfg.sh: bind bond and bridge interfaces to HW
either by s390 SUBCHANNELS or HWADDR, if the interface name is not
persistent.

Previously, this was bound unconditionally with HWADDR.
2014-09-12 09:49:58 +02:00
Harald Hoyer 967cc19ab1 remove all vim and emacs code format comments 2014-08-29 13:38:47 +02:00
Alex Harpin 32125a976b bridging: update the ifcfg files generated for bridge slaves
Update the ifcfg files generated for bridge slaves so they reference
the bridge they are part of.  Related to early patch submitted as a
fix for Bug #1123552.

Bug #1123552 https://bugzilla.redhat.com/show_bug.cgi?id=1123552
2014-08-11 20:16:06 +02:00
Harald Hoyer 2db6d71118 fixed bridge setup
renamed "ethnames" in bridge.info to "bridgeslaves"

fixed ifcfg generation
2014-08-01 13:16:29 +02:00
Harald Hoyer 7b46244bb9 network: add rd.route parameter 2014-07-22 11:52:52 +02:00
Harald Hoyer f1a38e5294 ifcfg: depends on network 2014-06-30 12:03:12 +02:00
Alex Harpin 83c9ff7dbb bonding: use hwaddr of the slave rather than the master
When a bonded interface is brought up, any slaves included in the bond
have their hardware address set to that of the bond master.  Although
this allows an interface to be brought up on start up, when the
configuration file is imported into the booted system it prevents
the bonded interface being successfully restarted.

The fix involves obtaining the hardware address of the slaves before
they are added to the bond and then using this value in the
configuration file.
2014-06-03 12:26:01 +02:00
Harald Hoyer 8fa1afb65c ifcfg/write-ifcfg.sh: include net-lib.sh
otherwise is_persistent_ethernet_name() is missing
2014-05-16 13:33:17 +02:00
Harald Hoyer 1230f3bcff ifcfg/write-ifcfg.sh: "IPV6INIT=yes" check also for non-dhcp 2014-05-12 13:53:38 +02:00
Chapman Flack 2c19a5fa78 Specify strstr tightly, add strglob/strglobin.
By convention, strstr should be a literal string match. Previously, it
would match as a glob pattern. Some code used that, so add new
functions strglob and strglobin to do what that code expects, and
specify them tightly too. strglob tests whether the glob pattern
matches the entire string (the name strglob is also used in the yorick
language, and that's what it does there), while strglobin tests whether
the glob pattern matches anywhere in the string.

Also tightens str_starts, str_ends, and str_replace to deal with
literal strings only. In a quick grep I did not find code that depended
on these functions matching globs.

Changes the call sites where strstr was used with glob patterns to use
strglobin or strglob as the intention seemed to be (or, in one case,
strstr with the * removed as it did not affect the result anyway).
2014-04-07 10:49:07 +02:00
Harald Hoyer 2e094b20a6 ifcfg: only bind to HWADDR, if addr_assign_type == 0
/sys/class/net/$netif/addr_assign_type is != 0 for random MAC address
interfaces
2014-04-04 12:52:39 +02:00
Harald Hoyer fb0e5184a6 ifcfg: do not bind persistent interface names to HWADDR 2014-04-04 12:48:32 +02:00
Harald Hoyer d4dd3521bb ifcfg/write-ifcfg.sh: turn on IPV6INIT, if any inet6 address is found
If "ip -6 addr" finds any inet6 address, assume IPV6INIT=yes for the
ifcfg file.
2014-04-03 08:53:09 +02:00
Harald Hoyer 43a85a7365 network: merge setup_net_$netif.ok and net.$netif.did-setup
one marker per interface is enough
2014-02-28 12:10:41 +01:00
Harald Hoyer 79b3c8bfa1 ifcfg/write-ifcfg.sh: do not bind s390 to MAC if SUBCHANNELS set
If SUBCHANNELS are set, do not specify HWADDR, because the SUBCHANNELS
are the identifier for the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1056438
2014-02-26 15:02:46 +01:00
Harald Hoyer 8bcfd683bd */module-setup.sh: add comments for dracut called functions 2013-10-08 10:37:56 +02:00
Harald Hoyer f34e1d6b0e network: do not depend on ifcfg
rather let ifcfg return 0 if /etc/sysconfig/network-scripts exists
2013-08-20 15:09:33 +02:00
Radek Vykydal 030b00b8a5 Generate correct ifcfg file for vlan= option. 2013-07-31 15:47:33 +02:00
Harald Hoyer caf207afa7 ifcfg/write-ifcfg.sh: fixed logic
seems like nobody tested this with recent dracut versions.
2013-05-30 14:37:41 +02:00
Harald Hoyer 6625c085ae ifcfg/write-ifcfg.sh:
- fix ONBOOT for slaves
- set TYPE=Bond for bonding

https://bugzilla.redhat.com/show_bug.cgi?id=919001
2013-05-29 14:38:52 +02:00
Harald Hoyer 284d62da81 ifcfg/write-ifcfg.sh: proper NAME the interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=965842
2013-05-28 16:56:40 +02:00
Harald Hoyer d136ca4eeb network: support multiple bonding interfaces
Currently dracut only support 1 bond, namyly bond0 by default. However multiple
bonds configuration may be needed. For example in kdump, in 1st kernel, more
than one bonds may be configured, and bondX other than bond0 is used as output
interface to remote host which will store dump core. This patch can solve this
problem, to write real bond information to initramfs, 2nd kdump kernel will
use it to create the relevant bondX interface.

Tested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Baoquan He <bhe@redhat.com>
2013-04-09 10:52:22 +02:00
Harald Hoyer e0e99c59a5 ifcfg/write-ifcfg.sh: fixed typo 2013-03-14 18:30:35 +01:00
Radek Vykydal fd8e4aef90 Write BOOTPROTO=ibft for ip=ibft to ifcfg files 2013-03-14 10:54:28 +01:00
Radek Vykydal c5a742a3bf Don't write DHCPV6C=yes for each dhcp (ipv4) configuration.
Caused probably by commit 32ec0a762d
2013-03-14 10:54:28 +01:00
Radek Vykydal cbd60fcaaf Do not overwrite ifcfg files generated by Anaconda kickstart (#865192) 2012-10-16 14:43:13 +02:00
Harald Hoyer 32ec0a762d ifcfg/write-ifcfg.sh: add "IPV6INIT=yes" for IPv6
https://bugzilla.redhat.com/show_bug.cgi?id=852808
2012-09-06 11:38:48 +02:00
Will Woods 30430fbe30 ifcfg: fix output for ipv6 static addressing
IPV6 configuration is pretty different than IPV4; write out the correct
set of values to make static IPV6 addressing work.
2012-06-12 19:24:46 +02:00
Will Woods 31cfc9aa5e dracut-lib.sh: add copytree(), use it where applicable
copytree() recursively copies the contents of SRC into DEST.

If DEST doesn't exist it is created; if it exists the contents of SRC
get merged into it (duplicate files are overwritten).
2012-05-29 11:32:44 +02:00
Harald Hoyer 02805bd1fc ifcfg/write-ifcfg.sh: fixed IFS resetting 2012-05-22 11:36:41 +02:00
Harald Hoyer a82d207b8d ifcfg/write-ifcfg.sh: add s390 specific configuration options
https://bugzilla.redhat.com/show_bug.cgi?id=811521
2012-05-10 14:34:53 +02:00
Harald Hoyer 5bfbfbfc22 ifcfg/write-ifcfg.sh: use PREFIX for prefix netmask form
https://bugzilla.redhat.com/show_bug.cgi?id=820185
2012-05-09 14:58:52 +02:00
Will Woods 335bb5a35b ifcfg: fix resolv.conf
/etc/net.*.resolv.conf is not a useful filename; copy it to resolv.conf
2012-05-02 14:41:37 +02:00
Harald Hoyer eb6e141adb ifcfg: write DNS1=... for nameserver= args (RHBZ#815369)
If you're using a static network config, you'll want to keep your
nameservers around when NM starts. Write DNS1 (and DNS2, DNS3, etc..)
into the ifcfg file.

Thanks to Mark Hamzy <hamzy@us.ibm.com>
and Will Woods <wwoods@redhat.com> for the patch.
2012-04-24 13:08:57 +02:00
Harald Hoyer 990e945ffd add mtu and macaddr to ip= 2012-04-05 13:25:41 +02:00
Will Woods 66666c670a write-ifcfg.sh: add UUID=.. and save the lease files with the same uuid
As described in https://bugzilla.redhat.com/show_bug.cgi?id=541410#c2,
if you want NetworkManager to take over an interface that you're using
for NFS root (or other network root device), you need to:

a) set UUID=<uuid> in ifcfg-<iface>, and
b) save the lease file as /var/lib/dhclient-<uuid>-<iface>.lease

This patch should make write-ifcfg handle both these things.
2012-03-08 10:58:42 +01:00