- edit computer name, not full hostname

This commit is contained in:
Stanislav Ievlev 2009-03-04 12:10:07 +03:00
parent 29667ede8b
commit 828fa2a0c8
4 changed files with 33 additions and 12 deletions

View File

@ -102,7 +102,6 @@ write_search()
}
### hostname
read_hostname()
{
local netconfig="/etc/sysconfig/network"
@ -122,6 +121,27 @@ write_hostname()
shell_config_del "$netconfig" DOMAINNAME
}
### computer name
read_computer_name()
{
local value="$(read_hostname)"
echo "${value%%.*}"
}
read_computer_domain()
{
local value="$(read_hostname)"
local domain="${value#*.}"
[ "$value" != "$domain" ] || domain="localdomain"
echo "$domain"
}
write_computer_name()
{
write_hostname "$1.$(read_computer_domain)"
}
### interface work
list_mask()
@ -355,7 +375,7 @@ on_message()
{
case "$in_action" in
type)
write_type_item hostname hostname
write_type_item computer_name system-computer-name
write_type_item ip ipv4-address
write_type_item default ipv4-address
@ -377,7 +397,8 @@ on_message()
write_string_param name "$name"
write_string_param hostname "$(read_hostname)"
write_string_param computer_name "$(read_computer_name)"
write_string_param computer_domain "$(read_computer_domain)"
write_string_param dns "$(read_dns)"
write_string_param search "$(read_search)"
;;
@ -389,7 +410,7 @@ on_message()
[ -n "$name" ] && write_iface "$name"
[ -n "$in_hostname" ] && write_hostname "$in_hostname"
[ -n "$in_computer_name" ] && write_computer_name "$in_computer_name"
[ -n "$in_dns" ] && write_dns "$in_dns"
[ -n "$in_search" ] && write_search "$in_search"

View File

@ -15,7 +15,7 @@
'("name")
cmd)
(form-update-value-list
'("hostname" "dns" "search")
'("computer_name" "dns" "search")
cmd)
(form-update-value-list
'("adaptor" "ip" "mask" "default" "hw_binding" "configuration")
@ -32,7 +32,7 @@
"/net-eth"
'name name
(form-value-list '("language"
"hostname" "dns" "search"
"computer_name" "dns" "search"
"ip" "mask" "default" "hw_binding" "configuration"))))
(define (wireless-interface)

View File

@ -8,8 +8,8 @@
<td colspan="2">
<table class="form-table">
<tr>
<td><span translate="_" name="hostname">Host name:</span></td>
<td><input type="text" class="text" name="hostname"/></td>
<td><span translate="_" name="computer_name">Computer name:</span></td>
<td><input type="text" class="text" name="computer_name"/></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>

View File

@ -14,7 +14,7 @@
'("name")
cmd)
(form-update-value-list
'("hostname" "dns" "search")
'("computer_name" "dns" "search")
cmd)
(form-update-value-list
'("adaptor" "ip" "mask" "default" "hw_binding" "configuration")
@ -30,7 +30,7 @@
(apply woo-write
"/net-eth"
'name name
(form-value-list '("hostname" "dns" "search"
(form-value-list '("computer_name" "dns" "search"
"ip" "mask" "default" "hw_binding" "configuration"))))
@ -77,8 +77,8 @@
columns "0;40;60"
;;
(label text (_ "Host name:") name "hostname" align "right")
(edit name "hostname")
(label text (_ "Computer name:") name "computer_name" align "right")
(edit name "computer_name")
(spacer)
;;