FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
#!/bin/sh # Copyright (c) 2007-2008 Volker Theile (votdev@gmx.de) # All rights reserved. # PROVIDE: hosts # REQUIRE: var # BEFORE: netif . /etc/util.subr . /etc/configxml.subr echo "Updating hosts." # Get interface address _if=`configxml_get "//interfaces/lan/if"` _ipaddr=`get_ipaddr inet ${_if}` # Generate /etc/hosts file /usr/local/bin/xml sel -t -m "//system" \ -v "concat('::1 localhost localhost.',domain)" -n \ -v "concat('127.0.0.1 localhost localhost.',domain)" -n \ -o "${_ipaddr} " -v "concat(hostname,'.',domain,' ',hostname)" -n \ -m "//system/hosts" \ -i "string-length(name) > 0" -v "concat(address,' ',name)" -n -b \ -b \ ${configxml_file} | /usr/local/bin/xml unesc > /etc/hosts