- merge with alterator-net-general
This commit is contained in:
Stanislav Ievlev 2008-04-28 16:34:43 +04:00
parent 27d7bf579e
commit 697305df7d
8 changed files with 384 additions and 133 deletions

View File

@ -1,8 +1,8 @@
%define _altdata_dir %_datadir/alterator
Name: alterator-net-eth
Version: 1.0
Release: alt6
Version: 2.0
Release: alt1
Packager: Stanislav Ievlev <inger@altlinux.org>
@ -16,6 +16,11 @@ Requires: alterator-net-common >= 0.2-alt3
Requires: alterator-net-wifi
Conflicts: alterator-fbi < 0.15-alt2
Provides: alterator-net-general = %version
Obsoletes: alterator-net-general
%add_findreq_skiplist %_datadir/install2/preinstall.d/*
BuildPreReq: alterator >= 3.1 alterator-fbi >= 0.7-alt1
BuildArch: noarch
@ -53,8 +58,13 @@ alterator module for tcp/ip connections configuration
%_altdata_dir/help/*/*
%_alterator_backend3dir/*
%_alterator_backend2dir/*
%_datadir/install2/preinstall.d/*
%changelog
* Mon Apr 28 2008 Stanislav Ievlev <inger@altlinux.org> 2.0-alt1
- merge with alterator-net-general
* Sat Apr 26 2008 Stanislav Ievlev <inger@altlinux.org> 1.0-alt6
- html UI: remove template-*, sync with qt UI
- backend: don't use ifvar utility, simplify list_iface result

View File

@ -5,8 +5,12 @@ INSTALL=/usr/bin/install
all:
clean: clean-po
install: install-backend install-ui install-po
install: install-backend install-ui install-po install-data
include /usr/share/alterator/build/po.mak
include /usr/share/alterator/build/ui2.mak
include /usr/share/alterator/build/backend.mak
install-data:
install -d $(datadir)/install2
cp -a preinstall.d $(datadir)/install2

View File

@ -3,6 +3,9 @@
cachedir="/var/cache/alterator/net-eth"
po_domain="alterator-net-eth"
rdelim='[[:space:]]\+'
wdelim=' '
. alterator-sh-functions
. shell-config
@ -19,6 +22,8 @@ init_cache()
fi
[ -f "$cachedir/iftab" ] || cp /etc/iftab "$cachedir/iftab"
[ -f "$cachedir/resolv.conf" ] || cp /etc/resolv.conf "$cachedir/resolv.conf"
[ -f "$cachedir/network" ] || cp /etc/sysconfig/network "$cachedir/network"
}
clear_cache()
@ -27,18 +32,97 @@ clear_cache()
mkdir "$cachedir"
}
commit_hostname()
{
local value="$(shell_config_get /etc/sysconfig/network HOSTNAME)"
[ -n "$value" ] || return
hostname "$value"
printf %s\\n "$value" >/etc/HOSTNAME
#bind hostname
grep -qs "^[^#]*\<$value\>" /etc/hosts ||
printf '127.0.0.1\t%s %s\n' "$value" "${value%%.*}" >> /etc/hosts
}
commit_cache()
{
[ -f "$cachedir/iftab" ] && mv -f "$cachedir/iftab" /etc/iftab
[ -f "$cachedir/resolv.conf" ] && mv -f "$cachedir/resolv.conf" /etc/resolv.conf
[ -f "$cachedir/network" ] && mv -f "$cachedir/network" /etc/sysconfig/network
commit_hostname
find $cachedir -maxdepth 1 -mindepth 1 -type d|
while read iface; do
[ -n "$iface" ] || exit
rm -rf "/etc/net/ifaces/${iface##*/}"
mv -f "$iface" "/etc/net/ifaces/${iface##*/}"
done
clear_cache
}
### dns
read_dns()
{
local resolv_conf="/etc/resolv.conf"
[ -f "$cachedir/resolv.conf" ] && resolv_conf="$cachedir/resolv.conf"
shell_config_get "$resolv_conf" nameserver "$rdelim"| tr '\n' ' '
}
write_dns()
{
local resolv_conf="$cachedir/resolv.conf"
shell_config_del "$resolv_conf" nameserver "$rdelim"
local IFS=' '
for i in $1;do
printf 'nameserver %s\n' "$i" >>"$resolv_conf"
done
}
read_search()
{
local resolv_conf="/etc/resolv.conf"
[ -f "$cachedir/resolv.conf" ] && resolv_conf="$cachedir/resolv.conf"
shell_config_get "$resolv_conf" search "$rdelim"|
tail -n1
}
write_search()
{
local resolv_conf="$cachedir/resolv.conf"
local IFS=' '
shell_config_del "$resolv_conf" search "$rdelim"
shell_config_set "$resolv_conf" search "$1" "$rdelim" "$wdelim"
}
### hostname
read_hostname()
{
local netconfig="/etc/sysconfig/network"
[ -f "$cachedir/network" ] && netconfig="$cachedir/network"
local value="$(shell_config_get "$netconfig" HOSTNAME)"
[ -n "$value" ] || value="localhost.localdomain"
echo "$value"
}
write_hostname()
{
local netconfig="$cachedir/network"
shell_config_set "$netconfig" HOSTNAME "$1"
shell_config_del "$netconfig" DOMAINNAME
}
### interface work
list_mask()
@ -259,17 +343,18 @@ on_message()
constraints)
echo '('
if [ "$in__objects" != "/" ];then
printf 'info (label "%s")' "`_ "Interface state"`"
printf 'hostname (required #t hostname #t label "%s" default "localhost.localdomain")\n' \
"`_ "Host name"`"
printf 'search (hostname #t label "%s")\n' \
"`_ "Search domains"`"
printf 'dns (ipv4-address #t label "%s")' \
"`_ "DNS servers"`"
printf 'dhcp (exclude (#t ip) exclude (#t default) exclude (#t mask) default #f label "%s")' \
"`_ "Use DHCP"`"
printf 'ip (required #t ipv4-address #t label "%s")' \
"`_ "IP address"`"
printf 'default (ipv4-address #t label "%s")' \
"`_ "Default gateway"`"
printf 'mask (label "%s")' \
"`_ "NetMask"`"
printf 'hw_binding (label "%s")' \
"`_ "Hardware binding"`"
fi
echo ')'
;;
@ -287,16 +372,24 @@ on_message()
echo "("
local name="${in_ifname}"
[ -n "$name" ] || name="$(iflist|cut -f1 -d' '|head -n1)"
printf 'name "%s"' "$name"
read_iface "$name"
[ -n "$name" ] && read_iface "$name"
printf "hostname \"%s\"\n" "$(read_hostname)"
printf "dns \"%s\"\n" "$(read_dns)"
printf "search \"%s\"\n" "$(read_search)"
echo ")"
;;
write)
local name="${in_ifname}"
[ -n "$name" ] || name="$(iflist|cut -f1 -d' '|head -n1)"
[ -n "$name" ] && write_iface "$name"
[ -n "$in_hostname" ] && write_hostname "$in_hostname"
[ -n "$in_dns" ] && write_dns "$in_dns"
[ -n "$in_search" ] && write_search "$in_search"
write_iface "$name"
[ -n "$in_commit" ] && commit_iface
[ -n "$in_reset" ] && reset_iface
write_nop

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-04-26 12:10+0400\n"
"POT-Creation-Date: 2008-04-28 16:32+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,112 +16,131 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/index.scm:96 стандартный ввод:2
#.
#: ui/net-eth/index.scm:112
msgid "Host name:"
msgstr ""
#.
#: ui/net-eth/index.scm:120
msgid "DNS servers:"
msgstr ""
#.
#: ui/net-eth/index.scm:125
msgid "Search domains:"
msgstr ""
#: ui/net-eth/index.scm:131
msgid "multiple values should be space separated"
msgstr ""
#: ui/net-eth/index.scm:139 стандартный ввод:2
msgid "Interfaces"
msgstr ""
#.
#: ui/net-eth/index.scm:111 стандартный ввод:4
#: ui/net-eth/index.scm:154 стандартный ввод:4
msgid "Status:"
msgstr ""
#.
#: ui/net-eth/index.scm:115 стандартный ввод:5
#: ui/net-eth/index.scm:158 стандартный ввод:5
msgid "Configuration:"
msgstr ""
#.
#: ui/net-eth/index.scm:125 стандартный ввод:6
#: ui/net-eth/index.scm:168 стандартный ввод:6
msgid "IP address:"
msgstr ""
#.
#: ui/net-eth/index.scm:129 стандартный ввод:7
#: ui/net-eth/index.scm:172 стандартный ввод:7
msgid "Netmask:"
msgstr ""
#.
#: ui/net-eth/index.scm:133 стандартный ввод:8
#: ui/net-eth/index.scm:176 стандартный ввод:8
msgid "Default gateway:"
msgstr ""
#.
#: ui/net-eth/index.scm:137 стандартный ввод:9
#: ui/net-eth/index.scm:180 стандартный ввод:9
msgid "Hardware binding:"
msgstr ""
#: ui/net-eth/index.scm:142 стандартный ввод:10
#: ui/net-eth/index.scm:185 стандартный ввод:10
msgid "Wireless settings..."
msgstr ""
#: ui/net-eth/index.scm:158 стандартный ввод:11
#: ui/net-eth/index.scm:203 стандартный ввод:11
msgid "Apply"
msgstr ""
#: ui/net-eth/index.scm:159 стандартный ввод:12
#: ui/net-eth/index.scm:204 стандартный ввод:12
msgid "Reset"
msgstr ""
#: backend3/net-eth:63
#: backend3/net-eth:147
msgid "missing"
msgstr ""
#: backend3/net-eth:64
#: backend3/net-eth:148
msgid "by MAC address"
msgstr ""
#: backend3/net-eth:65
#: backend3/net-eth:149
msgid "by bus location"
msgstr ""
#: backend3/net-eth:70
#: backend3/net-eth:154
msgid "Turned off"
msgstr ""
#: backend3/net-eth:71 backend3/net-eth:264
#: backend3/net-eth:155 backend3/net-eth:353
msgid "Use DHCP"
msgstr ""
#: backend3/net-eth:72
#: backend3/net-eth:156
msgid "Manually"
msgstr ""
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is up"
msgstr ""
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is down"
msgstr ""
#: backend3/net-eth:108
#: backend3/net-eth:192
msgid "plugged"
msgstr ""
#: backend3/net-eth:109
#: backend3/net-eth:193
msgid "unplugged"
msgstr ""
#: backend3/net-eth:262
msgid "Interface state"
#: backend3/net-eth:347
msgid "Host name"
msgstr ""
#: backend3/net-eth:266
#: backend3/net-eth:349
msgid "Search domains"
msgstr ""
#: backend3/net-eth:351
msgid "DNS servers"
msgstr ""
#: backend3/net-eth:355
msgid "IP address"
msgstr ""
#: backend3/net-eth:268
#: backend3/net-eth:357
msgid "Default gateway"
msgstr ""
#: backend3/net-eth:270
msgid "NetMask"
msgstr ""
#: backend3/net-eth:272
msgid "Hardware binding"
msgstr ""
#: стандартный ввод:1
msgid "IP interfaces"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-04-26 12:10+0400\n"
"POT-Creation-Date: 2008-04-28 16:32+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,112 +15,131 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/index.scm:96 стандартный ввод:2
#.
#: ui/net-eth/index.scm:112
msgid "Host name:"
msgstr "Имя компьютера:"
#.
#: ui/net-eth/index.scm:120
msgid "DNS servers:"
msgstr "DNS-серверы:"
#.
#: ui/net-eth/index.scm:125
msgid "Search domains:"
msgstr "Домены поиска:"
#: ui/net-eth/index.scm:131
msgid "multiple values should be space separated"
msgstr "несколько значений записываются через пробел"
#: ui/net-eth/index.scm:139 стандартный ввод:2
msgid "Interfaces"
msgstr "Интерфейсы"
#.
#: ui/net-eth/index.scm:111 стандартный ввод:4
#: ui/net-eth/index.scm:154 стандартный ввод:4
msgid "Status:"
msgstr "Состояние:"
#.
#: ui/net-eth/index.scm:115 стандартный ввод:5
#: ui/net-eth/index.scm:158 стандартный ввод:5
msgid "Configuration:"
msgstr "Конфигурация:"
#.
#: ui/net-eth/index.scm:125 стандартный ввод:6
#: ui/net-eth/index.scm:168 стандартный ввод:6
msgid "IP address:"
msgstr "IP-адрес:"
#.
#: ui/net-eth/index.scm:129 стандартный ввод:7
#: ui/net-eth/index.scm:172 стандартный ввод:7
msgid "Netmask:"
msgstr "Маска сети:"
#.
#: ui/net-eth/index.scm:133 стандартный ввод:8
#: ui/net-eth/index.scm:176 стандартный ввод:8
msgid "Default gateway:"
msgstr "Шлюз по умолчанию:"
#.
#: ui/net-eth/index.scm:137 стандартный ввод:9
#: ui/net-eth/index.scm:180 стандартный ввод:9
msgid "Hardware binding:"
msgstr "Привязка:"
#: ui/net-eth/index.scm:142 стандартный ввод:10
#: ui/net-eth/index.scm:185 стандартный ввод:10
msgid "Wireless settings..."
msgstr "Параметры для беспроводных интерфейсов..."
#: ui/net-eth/index.scm:158 стандартный ввод:11
#: ui/net-eth/index.scm:203 стандартный ввод:11
msgid "Apply"
msgstr "Применить"
#: ui/net-eth/index.scm:159 стандартный ввод:12
#: ui/net-eth/index.scm:204 стандартный ввод:12
msgid "Reset"
msgstr "Вернуть"
#: backend3/net-eth:63
#: backend3/net-eth:147
msgid "missing"
msgstr "отсутствует"
#: backend3/net-eth:64
#: backend3/net-eth:148
msgid "by MAC address"
msgstr "по аппаратному адресу (MAC)"
#: backend3/net-eth:65
#: backend3/net-eth:149
msgid "by bus location"
msgstr "по местоположению на шине"
#: backend3/net-eth:70
#: backend3/net-eth:154
msgid "Turned off"
msgstr "Выключено"
#: backend3/net-eth:71 backend3/net-eth:264
#: backend3/net-eth:155 backend3/net-eth:353
msgid "Use DHCP"
msgstr "Использовать DHCP"
#: backend3/net-eth:72
#: backend3/net-eth:156
msgid "Manually"
msgstr "Вручную"
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is up"
msgstr "интерфейс включён"
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is down"
msgstr "интерфейс выключен"
#: backend3/net-eth:108
#: backend3/net-eth:192
msgid "plugged"
msgstr "провод подсоединён"
#: backend3/net-eth:109
#: backend3/net-eth:193
msgid "unplugged"
msgstr "провод отсоединён"
#: backend3/net-eth:262
msgid "Interface state"
msgstr "Состояние интерфейса"
#: backend3/net-eth:347
msgid "Host name"
msgstr "Имя компьютера"
#: backend3/net-eth:266
#: backend3/net-eth:349
msgid "Search domains"
msgstr "Домены поиска"
#: backend3/net-eth:351
msgid "DNS servers"
msgstr "DNS-серверы"
#: backend3/net-eth:355
msgid "IP address"
msgstr "IP-адрес"
#: backend3/net-eth:268
#: backend3/net-eth:357
msgid "Default gateway"
msgstr "Шлюз по умолчанию"
#: backend3/net-eth:270
msgid "NetMask"
msgstr "Маска сети"
#: backend3/net-eth:272
msgid "Hardware binding"
msgstr "Привязка"
#: стандартный ввод:1
msgid "IP interfaces"
msgstr "IP-интерфейсы"
@ -128,3 +147,4 @@ msgstr "IP-интерфейсы"
#: стандартный ввод:3
msgid "Select"
msgstr "Выбрать"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-04-26 12:04+0400\n"
"POT-Creation-Date: 2008-04-28 16:32+0400\n"
"PO-Revision-Date: 2007-08-13 20:57+0300\n"
"Last-Translator: Michael Shigorin <mike@altlinux.org>\n"
"Language-Team: Ukrainian <uk@li.org>\n"
@ -15,118 +15,137 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/index.scm:96 стандартный ввод:2
#.
#: ui/net-eth/index.scm:112
msgid "Host name:"
msgstr ""
#.
#: ui/net-eth/index.scm:120
msgid "DNS servers:"
msgstr ""
#.
#: ui/net-eth/index.scm:125
msgid "Search domains:"
msgstr ""
#: ui/net-eth/index.scm:131
msgid "multiple values should be space separated"
msgstr ""
#: ui/net-eth/index.scm:139 стандартный ввод:2
#, fuzzy
msgid "Interfaces"
msgstr "Інтерфейс"
#.
#: ui/net-eth/index.scm:111 стандартный ввод:4
#: ui/net-eth/index.scm:154 стандартный ввод:4
msgid "Status:"
msgstr ""
#.
#: ui/net-eth/index.scm:115 стандартный ввод:5
#: ui/net-eth/index.scm:158 стандартный ввод:5
msgid "Configuration:"
msgstr ""
#.
#: ui/net-eth/index.scm:125 стандартный ввод:6
#: ui/net-eth/index.scm:168 стандартный ввод:6
#, fuzzy
msgid "IP address:"
msgstr "IP-адреса"
#.
#: ui/net-eth/index.scm:129 стандартный ввод:7
#: ui/net-eth/index.scm:172 стандартный ввод:7
#, fuzzy
msgid "Netmask:"
msgstr "Мережева маска"
#.
#: ui/net-eth/index.scm:133 стандартный ввод:8
#: ui/net-eth/index.scm:176 стандартный ввод:8
#, fuzzy
msgid "Default gateway:"
msgstr "Шлюз по змовчуванню"
#.
#: ui/net-eth/index.scm:137 стандартный ввод:9
#: ui/net-eth/index.scm:180 стандартный ввод:9
msgid "Hardware binding:"
msgstr ""
#: ui/net-eth/index.scm:142 стандартный ввод:10
#: ui/net-eth/index.scm:185 стандартный ввод:10
#, fuzzy
msgid "Wireless settings..."
msgstr "Налаштування бездротових інтерфейсів"
#: ui/net-eth/index.scm:158 стандартный ввод:11
#: ui/net-eth/index.scm:203 стандартный ввод:11
msgid "Apply"
msgstr "Застосувати"
#: ui/net-eth/index.scm:159 стандартный ввод:12
#: ui/net-eth/index.scm:204 стандартный ввод:12
msgid "Reset"
msgstr "Скинути"
#: backend3/net-eth:63
#: backend3/net-eth:147
msgid "missing"
msgstr ""
#: backend3/net-eth:64
#: backend3/net-eth:148
#, fuzzy
msgid "by MAC address"
msgstr "IP-адреса"
#: backend3/net-eth:65
#: backend3/net-eth:149
msgid "by bus location"
msgstr ""
#: backend3/net-eth:70
#: backend3/net-eth:154
msgid "Turned off"
msgstr ""
#: backend3/net-eth:71 backend3/net-eth:264
#: backend3/net-eth:155 backend3/net-eth:353
msgid "Use DHCP"
msgstr "Використовувати DHCP"
#: backend3/net-eth:72
#: backend3/net-eth:156
msgid "Manually"
msgstr ""
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is up"
msgstr "інтерфейс піднято"
#: backend3/net-eth:103
#: backend3/net-eth:187
msgid "interface is down"
msgstr "інтерфейс опущено"
#: backend3/net-eth:108
#: backend3/net-eth:192
msgid "plugged"
msgstr "увімкнуто"
#: backend3/net-eth:109
#: backend3/net-eth:193
msgid "unplugged"
msgstr "вимкнуто"
#: backend3/net-eth:262
msgid "Interface state"
msgstr "Стан інтерфейсу"
#: backend3/net-eth:347
msgid "Host name"
msgstr ""
#: backend3/net-eth:266
#: backend3/net-eth:349
msgid "Search domains"
msgstr ""
#: backend3/net-eth:351
msgid "DNS servers"
msgstr ""
#: backend3/net-eth:355
msgid "IP address"
msgstr "IP-адреса"
#: backend3/net-eth:268
#: backend3/net-eth:357
msgid "Default gateway"
msgstr "Шлюз по змовчуванню"
#: backend3/net-eth:270
msgid "NetMask"
msgstr "Мережева маска"
#: backend3/net-eth:272
msgid "Hardware binding"
msgstr ""
#: стандартный ввод:1
msgid "IP interfaces"
msgstr "IP-інтерфейси"
@ -135,6 +154,12 @@ msgstr "IP-інтерфейси"
msgid "Select"
msgstr "Вибрати"
#~ msgid "Interface state"
#~ msgstr "Стан інтерфейсу"
#~ msgid "NetMask"
#~ msgstr "Мережева маска"
#~ msgid "Wireless settings"
#~ msgstr "Налаштування бездротових інтерфейсів"

View File

@ -0,0 +1,36 @@
#!/bin/sh
. install2-init-functions
case "$METHOD" in
cdrom|disk) exit 0 ;;
esac
run_chroot alterator-cmdline /net-eth action "write" \
commit '#t' \
hostname "${HOSTNAME:-localhost.localdomain}" \
search "${DOMAINNAME:-}" \
dns "${DNS_SERVER:-}${DNS_SERVER2:+ $DNS_SERVER2}"
iface="$(exec_chroot ip link show up |
sed -n -e '/^[[:digit:]]\+:/!d' -e '/^[[:digit:]]\+: lo:/d' -e 's/^[[:digit:]]\+: \([^:]\+\):.*/\1/p' -e 'q')"
if [ -n "$iface" ]; then
case "${BOOTPROTO:-}" in
static)
run_chroot alterator-cmdline "/net-eth" action "write" \
commit '#t' \
ifname "$iface" \
configuration 'static' \
ip "${IPADDR:-}" \
mask "${NETBITS:-}" \
default "${GATEWAY:-}"
;;
dhcp)
run_chroot alterator-cmdline "/net-eth" action "write" \
commit '#t' \
ifname "$iface" \
configuration 'dhcp'
;;
esac
fi

View File

@ -37,21 +37,32 @@
(widget rows (map cdr data))))
(define (read-interface name)
(and (not-empty-string? name)
(and (string? name)
(let ((cmd (woo-read-first "/net-eth" 'ifname name)))
(hostname text (woo-get-option cmd 'hostname))
(dns text (woo-get-option cmd 'dns))
(search text (woo-get-option cmd 'search))
(iface-info text (woo-get-option cmd 'info))
(iface-ip text (woo-get-option cmd 'ip))
(iface-mask current (param-index cmd 'mask *avail-masks*))
(iface-gw text (woo-get-option cmd 'default)
(iface-hw-binding current (param-index cmd 'hw_binding *avail-hw-bindings*))
(iface-configuration current (param-index cmd 'configuration *avail-configurations*))
(iface-configuration selected)
(w-button activity (woo-get-option cmd 'wireless))
(iface-gw text (woo-get-option cmd 'default)))))
(w-button activity (woo-get-option cmd 'wireless))))))
(define (write-interface path name)
(and (not-empty-string? name)
(and (string? name)
(woo-write/constraints
path
'hostname (hostname text)
'dns (dns text)
'search (search text)
'ifname name
'ip (iface-ip text)
'mask (param-value iface-mask *avail-masks*)
@ -60,14 +71,15 @@
'default (iface-gw text))))
(define (commit-interface)
(woo-catch/message
(thunk
(write-interface "/net-eth/" (current-interface))
(and (global 'frame:next)
(write-interface "/autoinstall/net-eth/" (current-interface)))
(woo-write "/net-eth" 'commit #t)
(and (global 'frame:next)
(woo-write "/net-eth" 'commit #t)))))
(let ((name (or (current-interface) "")))
(woo-catch/message
(thunk
(write-interface "/net-eth/" name)
(and (global 'frame:next)
(write-interface "/autoinstall/net-eth/" name))
(woo-write "/net-eth" 'commit #t)
(and (global 'frame:next)
(woo-write "/net-eth" 'commit #t))))))
(define (reset-interface)
(woo-catch/message
@ -78,14 +90,11 @@
(param-init "/net-eth/avail_masks" iface-mask *avail-masks*)
(param-init "/net-eth/avail_hw_bindings" iface-hw-binding *avail-hw-bindings*)
(param-init "/net-eth/avail_configurations" iface-configuration *avail-configurations*)
(param-init "/net-eth/avail_ifaces" ifaces *avail-ifaces*)
(let ((avail-ifaces (woo-list/name+label "/net-eth")))
(cell-set! *avail-ifaces* avail-ifaces)
(ifaces rows (map car avail-ifaces))
(or (null? avail-ifaces)
(begin (ifaces current 0)
(cell-set! *prev-current* 0)
(read-interface (current-interface))))))))
(read-interface "")
(cell-set! *prev-current* 0)
(or (null? (cell-ref *avail-ifaces*)) (ifaces current 0)))))
;;; UI
@ -93,6 +102,38 @@
columns "0;100"
margin 20
(gridbox
colspan 2
columns "0;40;60"
;;
(label text (_ "Host name:") align "right")
(document:id hostname (edit))
(spacer)
;;
(label colspan 3)
;;
(label text (_ "DNS servers:") align "right")
(document:id dns (edit))
(spacer)
;;
(label text (_ "Search domains:") align "right")
(document:id search (edit))
(spacer)
(spacer)
(label text (string-append "<small>("
(_ "multiple values should be space separated")
")<small>"))
(spacer)
)
(separator colspan 2)
(label text (bold (_ "Interfaces")))
(spacer)
@ -147,17 +188,20 @@
(and (not-empty-string? name)
(document:popup "/net-wifi/" 'interface name))))))
)
;;
(label colspan 2)
;;
(spacer)
(if (global 'frame:next)
(label)
(hbox align "left"
(button (_ "Apply") (when clicked (commit-interface)))
(button (_ "Reset") (when clicked (reset-interface)))))
))
(spacer)
)
;;;;;;;;;;;;;;;