Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

set hostname from xen domain name in DOMUs?



I've found it practical to have the hostname set to
the domain name before "dhclient" is called. It makes
it simpler to clone a domu, in particular if dynamic
IP addresses are used.
So I created this little rc.d script.
Does this make sense? Should I add it to
pkgsrc/xenstoretools?

best regards
Matthias


-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------

Kennen Sie schon unsere app? http://www.fz-juelich.de/app
#!/bin/sh

# PROVIDE: xendomname
# REQUIRE: network mountcritlocal
# BEFORE:  dhcpcd

$_rc_subr_loaded . /etc/rc.subr

name=xendomname
rcvar=$name
start_cmd="xendomname_start"

xendomname_start()
{
        mount /kern || true
        dname="`/usr/pkg/bin/xenstore-read name`"
        echo "Setting hostname to xen domain name: $dname"
        hostname "$dname"
}

load_rc_config $name
run_rc_command "$1"


Home | Main Index | Thread Index | Old Index