From 828fa2a0c822a66476470dfc58a51c098481b954 Mon Sep 17 00:00:00 2001 From: Stanislav Ievlev Date: Wed, 4 Mar 2009 12:10:07 +0300 Subject: [PATCH] - edit computer name, not full hostname --- alterator-net-eth/backend3/net-eth | 29 +++++++++++++++++++++---- alterator-net-eth/ui/net-eth/ajax.scm | 4 ++-- alterator-net-eth/ui/net-eth/index.html | 4 ++-- alterator-net-eth/ui/net-eth/index.scm | 8 +++---- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/alterator-net-eth/backend3/net-eth b/alterator-net-eth/backend3/net-eth index 8419abb..4dc5aed 100755 --- a/alterator-net-eth/backend3/net-eth +++ b/alterator-net-eth/backend3/net-eth @@ -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" diff --git a/alterator-net-eth/ui/net-eth/ajax.scm b/alterator-net-eth/ui/net-eth/ajax.scm index c4d2ae1..a168a15 100644 --- a/alterator-net-eth/ui/net-eth/ajax.scm +++ b/alterator-net-eth/ui/net-eth/ajax.scm @@ -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) diff --git a/alterator-net-eth/ui/net-eth/index.html b/alterator-net-eth/ui/net-eth/index.html index aa06767..a45faf4 100644 --- a/alterator-net-eth/ui/net-eth/index.html +++ b/alterator-net-eth/ui/net-eth/index.html @@ -8,8 +8,8 @@ - - + + diff --git a/alterator-net-eth/ui/net-eth/index.scm b/alterator-net-eth/ui/net-eth/index.scm index 17b47bd..83a5c65 100644 --- a/alterator-net-eth/ui/net-eth/index.scm +++ b/alterator-net-eth/ui/net-eth/index.scm @@ -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) ;;
Host name:Computer name: