# $Id$ push_firstboot 10_network_configuration push_config 10_network_hostname help_network_hostname() { local serial="${CLASS_ARGV[0]}" control_client "${serial}" help network.hostname mecho "get network.hostname" mecho " Displays the current hostname" mecho mecho "set network.hostname [hostname]" mecho " Sets the hostname of the system" mecho " mcore - the local hostname" } set_network_hostname() { local serial="${CLASS_ARGV[0]}" local value="${CLASS_ARGV[1]}" import_resource cfg_network "${serial}" hostname "${value}" } control_network_hostname() { local serial="${CLASS_ARGV[0]}" push_config_10_network_hostname "${serial}" } push_config_10_network_hostname() { local serial="$1" local value value=$(mysqldo "select hostname from cfg_network where serial='${serial}'") if [[ -z ${value} ]] || [[ ${value} = NULL ]] then decho "retval NULL, not running 'control_client '${serial}' set network.hostname '${value}''" else control_client "${serial}" set network.hostname "${value}" fi } push_firstboot_10_network_configuration() { local serial="$1" local netcard_driver local networking local hostname local domain nsslsay_queue_init nsslsay_queue_add "nocolors" #nsslsay_queue_add "get hardware.detect driver netcard" nsslsay_queue_add "get hardware.detect driver connected-iface" netcard_driver=$(control_client "${serial}" run-queue) if [[ -n ${netcard_driver} ]] then decho "netcard_driver='${netcard_driver}'" import_resource cfg_network "${serial}" module "${netcard_driver}" else decho "no netcard_driver found" fi networking=$(mysqldo "select networking from cfg_network where serial=${serial};") if [[ -z ${networking} ]] || [[ ${networking} = NULL ]] then # set network to dhcp decho "networking='dhcp'" import_resource cfg_network "${serial}" networking "dhcp" fi hostname=$(mysqldo "select hostname from cfg_network where serial=${serial};") if [[ -z ${hostname} ]] || [[ ${hostname} = NULL ]] then # set hostname to MCORE_DEFAULT_HOSTNAME decho "hostname='${MCORE_DEFAULT_HOSTNAME}'" import_resource cfg_network "${serial}" hostname "${MCORE_DEFAULT_HOSTNAME}" fi domain=$(mysqldo "select domain from cfg_network where serial=${serial};") if [[ -z ${domain} ]] || [[ ${domain} = NULL ]] then # set domain to MCORE_DEFAULT_DOMAIN decho "hostname='${MCORE_DEFAULT_DOMAIN}'" import_resource cfg_network "${serial}" domain "${MCORE_DEFAULT_DOMAIN}" fi }