[rhel7/master v2] Move save_netinfo into a hook (#1048231)

Vratislav Podzimek vpodzime at redhat.com
Wed Feb 5 07:25:35 UTC 2014


On Tue, 2014-02-04 at 09:13 -0800, Brian C. Lane wrote:
> There were a couple of issues here - echoing a command into a hookfile
> isn't the right way to setup a hook anymore, use inst_hook in
> module-setup.sh for that. And the script was being run after
> 11-fetch-kickstart-net.sh because of its name. It is now installed as
> 00-anaconda-ifcfg.sh
> 
> This also changes new_dhcp_next_server to new_next_server, which is the
> variable that is actually set by dhclient. This lets it find the nfs
> server when it is different from the dhcp server.
> 
> Resolves: rhbz#1048231
> 
> -- NOTE: v2 changes new_dhcp_next_server to new_next_server thanks to the
> --       reporter trying the fix.
> ---
>  dracut/Makefile.am               | 1 +
>  dracut/anaconda-ifcfg.sh         | 8 ++++++++
>  dracut/fetch-kickstart-net.sh    | 2 +-
>  dracut/module-setup.sh           | 1 +
>  dracut/parse-anaconda-options.sh | 3 ---
>  5 files changed, 11 insertions(+), 4 deletions(-)
>  create mode 100755 dracut/anaconda-ifcfg.sh
> 
> diff --git a/dracut/Makefile.am b/dracut/Makefile.am
> index 3bab16a..c3080bc 100644
> --- a/dracut/Makefile.am
> +++ b/dracut/Makefile.am
> @@ -33,6 +33,7 @@ dist_dracut_SCRIPTS = module-setup.sh \
>  		      anaconda-diskroot \
>  		      anaconda-copy-ks.sh \
>  		      anaconda-copy-cmdline.sh \
> +		      anaconda-ifcfg.sh \
>  		      fetch-kickstart-net.sh \
>  		      fetch-kickstart-disk \
>  		      fetch-updates-disk \
> diff --git a/dracut/anaconda-ifcfg.sh b/dracut/anaconda-ifcfg.sh
> new file mode 100755
> index 0000000..c1718f1
> --- /dev/null
> +++ b/dracut/anaconda-ifcfg.sh
> @@ -0,0 +1,8 @@
> +#!/bin/bash
> +command -v getarg >/dev/null || . /lib/dracut-lib.sh
> +
> +# initqueue/online hook passes interface name as $1
> +netif="$1"
> +
> +# make sure we get ifcfg for every interface that comes up
> +save_netinfo $netif
> diff --git a/dracut/fetch-kickstart-net.sh b/dracut/fetch-kickstart-net.sh
> index 685d842..018f0f7 100755
> --- a/dracut/fetch-kickstart-net.sh
> +++ b/dracut/fetch-kickstart-net.sh
> @@ -22,7 +22,7 @@ if [ "$kickstart" = "nfs:auto" ]; then
>      # construct kickstart URL from dhcp info
>      # server is next_server, or the dhcp server itself if missing
>      . /tmp/net.$netif.dhcpopts
> -    server="${new_dhcp_next_server:-$new_dhcp_server_identifier}"
> +    server="${new_next_server:-$new_dhcp_server_identifier}"
>      # filename is dhcp 'filename' option, or '/kickstart/' if missing
>      filename="/kickstart/"
>      # read the dhcp lease file and see if we can find 'filename'
> diff --git a/dracut/module-setup.sh b/dracut/module-setup.sh
> index 4dd8a4c..59d3ad7 100755
> --- a/dracut/module-setup.sh
> +++ b/dracut/module-setup.sh
> @@ -32,6 +32,7 @@ install() {
>      inst_hook pre-trigger 50 "$moddir/kickstart-genrules.sh"
>      inst_hook pre-trigger 50 "$moddir/updates-genrules.sh"
>      inst_hook initqueue/settled 00 "$moddir/anaconda-ks-sendheaders.sh"
> +    inst_hook initqueue/online 00 "$moddir/anaconda-ifcfg.sh"
>      inst_hook initqueue/online 80 "$moddir/anaconda-netroot.sh"
>      inst "$moddir/anaconda-diskroot" "/sbin/anaconda-diskroot"
>      inst_hook pre-pivot 50 "$moddir/anaconda-copy-ks.sh"
> diff --git a/dracut/parse-anaconda-options.sh b/dracut/parse-anaconda-options.sh
> index 4ed6650..caa977d 100755
> --- a/dracut/parse-anaconda-options.sh
> +++ b/dracut/parse-anaconda-options.sh
> @@ -127,9 +127,6 @@ fi
>  # for vnc bring network up in initramfs so that cmdline configuration is used
>  getargbool 0 vnc inst.vnc && warn "anaconda requiring network for vnc" && set_neednet
>  
> -# make sure we get ifcfg for every interface that comes up
> -echo 'save_netinfo $netif' > $hookdir/initqueue/online/anaconda-ifcfg.sh
> -
>  # Driver Update Disk
>  warn_renamed_arg "dd" "inst.dd"
Still looks good to me :)

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list