dhcpcd-discuss

hostname_fqdn:=server not supported?

Walrath, Paul

Mon May 23 15:26:46 2016

Hi Roy,

I noticed that, in the 30-hostname script, the variable hostname_fqdn is specified as taking one of three values: true, server, false.  I'm not sure that a setting of server is fully implemented.  It could be that I just don't understand the hook script.  Is there a defect here?

In the function need_hostname() there is this code,

        case "$hostname_fqdn" in
        [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)      hfqdn=true;;
        [Ss][Ee][Rr][Vv][Ee][Rr])             ;;
        *)                                    hshort=true;;
        esac

In the function set_hostname() there is this code,


        case "$hostname_fqdn" in

        [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1)      hfqdn=true;;

        "")                                   ;;

        *)                                    hshort=true;;

        esac

In set_hostname(), the "server" setting is not specifically handled like it is in need_hostname().  Instead, the null string "" choice replaces the "server" string choice.

With this code in 30-hostname you get the following settings when hostname_fqdn==server,

need_hostname()
            hfqdn=false
            hshort=false
set_hostname()
            hfqdn=false
            hshort=true

I would think that you want hshort==false if hostname_fqdn==server.  That way you would get the following in set_hostname(),


        if [ -n "$new_fqdn" ]; then


                       try_hostname "$new_fqdn"


        elif [ -n "$new_host_name" ]; then


                       try_hostname "$new_host_name"


If hshort==true, then the code strips off any domain name suffix before setting the host name.


        if [ -n "$new_fqdn" ]; then


                       try_hostname "${new_fqdn%%.*}"



        elif [ -n "$new_host_name" ]; then


                       try_hostname "${new_host_name%%.*}"

Please let me know what you think.

Paul



Follow-Ups:
RE: hostname_fqdn:=server not supported?Walrath, Paul
Re: hostname_fqdn:=server not supported?Roy Marples
Archive administrator: postmaster@marples.name