alterator-net-eth-0.9/ 0000755 0000000 0000000 00000000000 11055303706 0014717 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/Makefile 0000644 0000000 0000000 00000000652 11055303706 0016362 0 ustar 00root root 0000000 0000000 NAME=net-eth
DESCRIPTION="IP interfaces"
INSTALL=/usr/bin/install
all:
clean: clean-po
install: install-backend install-ui install-po install-html
include /usr/share/alterator/build/po.mak
include /usr/share/alterator/build/ui2.mak
include /usr/share/alterator/build/backend.mak
include /usr/share/alterator/build/fbi.mak
include /usr/share/alterator/build/html-messages.mak
HTML_PO_TEMPLATE=ui/net-eth/html-messages.scm
alterator-net-eth-0.9/applications/ 0000755 0000000 0000000 00000000000 11055303706 0017405 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/applications/net-eth.desktop 0000644 0000000 0000000 00000000377 11055303706 0022353 0 ustar 00root root 0000000 0000000 [Desktop Entry]
Type=Application
Categories=X-Alterator-Network
Icon=net-eth
Terminal=false
Name=IP interfaces
Name[ru_RU]=IP-интерфейсы
Name[uk_UA]=IP-інтерфейси
X-Alterator-URI=/net-eth
X-Alterator-Weight=30
X-Alterator-Help=net-eth
alterator-net-eth-0.9/backend3/ 0000755 0000000 0000000 00000000000 11055303706 0016371 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/backend3/net-eth 0000755 0000000 0000000 00000012441 11055303706 0017665 0 ustar 00root root 0000000 0000000 #!/bin/sh
iftab_file="/etc/iftab"
_()
{
LANG=${in_language%%;*}.utf8 gettext "alterator-net-eth" "$1"
}
################### shell file helpers
PATH="/usr/lib/alterator-net-common:$PATH"
shell_add_or_subst()
{
local name="$1" && shift
local value="$1" && shift
local file="$1" && shift
[ -f "$file" ] || touch "$file"
if grep -qs "^$name" "$file"; then
/bin/sed -r -i "s,^$name.*,$name$value," -- "$file"
return 0
fi
printf %s\\n "$name$value" >> "$file"
}
shell_get()
{
local name="$1" && shift
local file="$1" && shift
[ -f "$file" ] &&
grep -qs "^$name=" "$file" &&
grep "^$name=" "$file"|sed "s,^$name=,,"
}
################### interface modificators
list_mask()
{
for i in `seq 32 -1 0`; do
printf '("%s" label "/%s (%s)")' "$i" "$i" "$(maskname "$i")"
done
}
list_iface()
{
iflist|
while read iface mac; do
printf '("%s" label "%s (%s)")' "$iface" "$iface" "$(ifaceinfo "$iface")"
done
}
list_hw_binding()
{
printf '("missing" label "%s")' "`_ "missing"`"
printf '("mac" label "%s")' "`_ "by MAC address"`"
printf '("businfo" label "%s")' "`_ "by bus location"`"
}
restart_iface()
{
ifdown "$1" && ifup "$1"
}
restart_all_ifaces() {
iflist|
while read iface mac; do
restart_iface "$iface"
done >&2
}
read_hw_binding()
{
local line="$(grep "^[[:space:]]*$1[[:space:]]" "$iftab_file")"
if [ -z "$line" ]; then
echo "missing"
else
if echo "$line" | fgrep -qsw mac; then
echo "mac"
elif echo "$line" | fgrep -qsw businfo; then
echo "businfo"
else
echo "missing"
fi
fi
}
read_iface()
{
local name="$1" && shift
echo "("
#collect general information
local info=
ifcheckup "$name" && info="`_ "interface is up"`" || info="`_ "interface is down"`"
if ! ifcheckwireless "$name"; then
ifcheckplug "$name"
case "$?" in
2) info="$info, `_ "plugged"`" ;;
3) info="$info, `_ "unplugged"`" ;;
esac
fi
printf 'info "%s" ' "$info"
printf 'wireless %s ' "$(ifcheckwireless "$name" && echo "#t" || echo "#f")"
printf 'hw_binding "%s" ' "$(read_hw_binding "$name")"
local addr= ip= mask= bootproto=
[ ! -s "/etc/net/ifaces/$name/ipv4address" ] ||
addr=$(grep '^[0-9]' "/etc/net/ifaces/$name/ipv4address" | head -n1 || echo "")
if [ -n "$addr" ]; then
ip="${addr%%/*}"
mask="${addr#$ip}"; mask="${mask#/}"
printf 'ip "%s" mask "%s"\n' "$ip" "${mask:-32}"
fi
[ ! -s "/etc/net/ifaces/$name/ipv4route" ] ||
printf 'default "%s"\n' \
$(grep '^default' "/etc/net/ifaces/$name/ipv4route" | sed -r 's,default[[:space:]]+via[[:space:]],,' || echo "")
bootproto="$(ifvar "$name" "BOOTPROTO")"
[ "$bootproto" = "dhcp" ] && echo "dhcp #t" || echo "dhcp #f"
echo ")"
}
write_hw_binding()
{
local name="$1";shift
local value="$1";shift
local mac="$(ifread "$name"|cut -f1)"
local businfo="$(ifread "$name"|cut -f2)"
if [ -s "$iftab_file" ]; then
sed -r \
-e "/^$name[[:space:]]/ d" \
-i "$iftab_file"
[ -z "$mac" ] ||
[ "$mac" = "00:00:00:00:00:00" ] ||
sed -r \
-e "/[[:space:]]mac[[:space:]]+$mac([[:space:]]|\$)/ d" \
-i "$iftab_file"
[ -z "$businfo" ] ||
sed -r \
-e "/[[:space:]]businfo[[:space:]]+$businfo([[:space:]]|\$)/ d" \
-i "$iftab_file"
fi
case "$value" in
none) ;;
mac)
[ -z "$mac" ] ||
[ "$mac" = "00:00:00:00:00:00" ] ||
printf "%s\tmac %s\n" "$name" "$mac" >>"$iftab_file"
;;
businfo)
[ -z "$businfo" ] ||
printf "%s\tbusinfo %s\n" "$name" "$businfo" >>"$iftab_file"
;;
esac
}
write_iface()
{
local name="$1" && shift
local ifacedir="/etc/net/ifaces/$name"
local options="$ifacedir/options"
[ -d "$ifacedir" ] || mkdir "$ifacedir"
[ -n "$in_mask" ] && [ -n "$in_ip" ] && \
printf '%s/%s\n' "$in_ip" "$in_mask" >"/etc/net/ifaces/$name/ipv4address"
[ -n "$in_default" ] && [ -s "/etc/net/ifaces/$name/ipv4address" ] && \
printf 'default via %s\n' "$in_default" >"/etc/net/ifaces/$name/ipv4route"
shell_add_or_subst "TYPE=" "eth" "$options"
[ -n "$in_dhcp" ] &&
shell_add_or_subst "BOOTPROTO=" \
$([ "$in_dhcp" = "#t" ] && echo "dhcp" || echo "static")\
"$options"
[ -n "$in_hw_binding" ] &&
write_hw_binding "$name" "$in_hw_binding"
}
. /usr/share/alterator/build/backend3.sh
#initial actions
ifup lo
on_message()
{
case "$in_action" in
constraints)
echo '('
printf 'info (label "%s")' "`_ "Interface state"`"
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"`"
echo ')'
;;
list)
echo '('
case "${in__objects##*/}" in
avail_masks) list_mask ;;
avail_hw_bindings) list_hw_binding ;;
*) list_iface;;
esac
echo ')'
;;
read)
if [ "$in__objects" == "/" ];then
echo '()'
else
read_iface "${in__objects}"
fi
;;
write)
write_iface "${in__objects}"
[ "$in_restart" = "#f" ] || restart_iface "$in__objects"
echo '()'
;;
restart)
restart_all_ifaces
echo '()'
;;
*)
echo '#f'
;;
esac
}
message_loop
alterator-net-eth-0.9/backend3/template-net-eth 0000755 0000000 0000000 00000001252 11055303706 0021474 0 ustar 00root root 0000000 0000000 #!/bin/sh
_()
{
LANG=${in_language%%;*}.utf8 gettext "alterator-net-eth" "$1"
}
#turn off auto expansion
set -f
. /usr/share/alterator/build/backend3.sh
on_message()
{
case "$in_action" in
#information for renderer
template)
if [ "$in__objects" = "/" ];then
echo '('
echo 'template "card-index" '
echo 'url "net-eth.html"'
echo 'help "net-eth.html"'
echo ')'
else
echo '#f'
fi
;;
info)
echo '('
printf ' title "%s"' "`_ "IP interfaces"`"
printf ' description "%s"' "`_ "IP interfaces administration"`"
printf ' group "%s"' "`_ "Network"`"
printf ' weight 89'
echo ')'
;;
*)
echo '#f'
esac
}
message_loop
alterator-net-eth-0.9/help/ 0000755 0000000 0000000 00000000000 11055303706 0015647 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/help/ru_RU/ 0000755 0000000 0000000 00000000000 11055303706 0016703 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/help/ru_RU/net-eth.html 0000644 0000000 0000000 00000003771 11055303706 0021145 0 ustar 00root root 0000000 0000000
Help - ALT Linux Console
IP-интерфейсы
IP (Internet Protocol) — основа стека протоколов
TCP/IP. "IP-адрес" и
"Маска сети" — обязательные параметры
каждого узла IP-сети. Первый параметр — уникальный идентификатор машины,
от второго напрямую зависит, к каким машинам локальной сети данная машина будет иметь доступ.
Если требуется выход во внешнюю сеть, то не забудьте про
параметр "Шлюз по умолчанию".
В случае наличия DHCP-сервера , можно все
вышеперечисленные параметры получить автоматически — просто
включите "Использовать DHCP".
Если в компьютере имеется несколько сетевых карт, то возможна ситуация, когда при очередной загрузке
ядро присвоит имена интерфейсов (eth0, eth1) в другом порядке. В результате интерфейсы получат не свои настройки.
Чтобы этого не происходило, вы можете
привязать интерфейс к имени по его аппаратному адресу (MAC) или по местоположению на системной шине.
alterator-net-eth-0.9/help/uk_UA/ 0000755 0000000 0000000 00000000000 11055303706 0016653 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/help/uk_UA/net-eth.html 0000644 0000000 0000000 00000002545 11055303706 0021113 0 ustar 00root root 0000000 0000000
Help - ALT Linux Console
IP-інтерфейси
IP (Internet Protocol) — основа стеку
протоколів TCP/IP. "IP address" та
"NetMask" — обов'язкові
параметри кожного вузла IP-мережі. Перший параметр —
унікальний ідентифікатор комп'ютера, а від другого напряму
залежить, до яких комп'ютерів та ресурсів локальної мережі
даний комп'ютер буде мати доступ. Якщо необхідний вихід до
зовнішньої мережі, то не забудьте про параметр
"Default gateway".
У випадку наявності DHCP-сервера , всі вищеперераховані
параметри можна отримати автоматично — просто
ввімкніть "Use DHCP".
alterator-net-eth-0.9/html/ 0000755 0000000 0000000 00000000000 11055303706 0015663 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/html/fbi/ 0000755 0000000 0000000 00000000000 11055303706 0016423 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/html/fbi/net-eth.html 0000644 0000000 0000000 00000003502 11055303706 0020655 0 ustar 00root root 0000000 0000000
IP interfaces - ALT Linux Console
IP interfaces
alterator-net-eth-0.9/po/ 0000755 0000000 0000000 00000000000 11055303706 0015335 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/po/alterator-net-eth.pot 0000644 0000000 0000000 00000004267 11055303706 0021431 0 ustar 00root root 0000000 0000000 # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-14 12:34+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/html-messages.scm:1 backend3/template-net-eth:30
msgid "IP interfaces"
msgstr ""
#: ui/net-eth/html-messages.scm:2 ui/net-eth/index.scm:16
msgid "Interface"
msgstr ""
#: ui/net-eth/html-messages.scm:3
msgid "Select"
msgstr ""
#: ui/net-eth/html-messages.scm:4 ui/net-eth/index.scm:55
msgid "Wireless settings"
msgstr ""
#: ui/net-eth/html-messages.scm:5 ui/net-eth/index.scm:65
msgid "Reset"
msgstr ""
#: ui/net-eth/html-messages.scm:6 ui/net-eth/index.scm:64
msgid "Apply"
msgstr ""
#: ui/net-eth/html-messages.scm:7
msgid "apply current settings and restart interface"
msgstr ""
#: ui/net-eth/index.scm:28 backend3/net-eth:210
msgid "Use DHCP"
msgstr ""
#: ui/net-eth/index.scm:33 backend3/net-eth:212
msgid "IP address"
msgstr ""
#: ui/net-eth/index.scm:38
msgid "Netmask"
msgstr ""
#: ui/net-eth/index.scm:43 backend3/net-eth:214
msgid "Default gateway"
msgstr ""
#: ui/net-eth/index.scm:49 backend3/net-eth:218
msgid "Hardware binding"
msgstr ""
#: ui/net-eth/index.scm:66
msgid "Quit"
msgstr ""
#: backend3/net-eth:57
msgid "missing"
msgstr ""
#: backend3/net-eth:58
msgid "by MAC address"
msgstr ""
#: backend3/net-eth:59
msgid "by bus location"
msgstr ""
#: backend3/net-eth:98
msgid "interface is up"
msgstr ""
#: backend3/net-eth:98
msgid "interface is down"
msgstr ""
#: backend3/net-eth:103
msgid "plugged"
msgstr ""
#: backend3/net-eth:104
msgid "unplugged"
msgstr ""
#: backend3/net-eth:208
msgid "Interface state"
msgstr ""
#: backend3/net-eth:216
msgid "NetMask"
msgstr ""
#: backend3/template-net-eth:31
msgid "IP interfaces administration"
msgstr ""
#: backend3/template-net-eth:32
msgid "Network"
msgstr ""
alterator-net-eth-0.9/po/ru.po 0000644 0000000 0000000 00000005556 11055303706 0016336 0 ustar 00root root 0000000 0000000 # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-14 12:34+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/html-messages.scm:1 backend3/template-net-eth:30
msgid "IP interfaces"
msgstr "IP-интерфейсы"
#: ui/net-eth/html-messages.scm:2 ui/net-eth/index.scm:16
msgid "Interface"
msgstr "Интерфейс"
#: ui/net-eth/html-messages.scm:3
msgid "Select"
msgstr "Выбрать"
#: ui/net-eth/html-messages.scm:4 ui/net-eth/index.scm:55
msgid "Wireless settings"
msgstr "Настройки для беспроводных интерфейсов"
#: ui/net-eth/html-messages.scm:5 ui/net-eth/index.scm:65
msgid "Reset"
msgstr "Cброс"
#: ui/net-eth/html-messages.scm:6 ui/net-eth/index.scm:64
msgid "Apply"
msgstr "Применить"
#: ui/net-eth/html-messages.scm:7
msgid "apply current settings and restart interface"
msgstr "применить текущие настройки и перезапустить интерфейс"
#: ui/net-eth/index.scm:28 backend3/net-eth:210
msgid "Use DHCP"
msgstr "Использовать DHCP"
#: ui/net-eth/index.scm:33 backend3/net-eth:212
msgid "IP address"
msgstr "IP-адрес"
#: ui/net-eth/index.scm:38
msgid "Netmask"
msgstr "Маска сети"
#: ui/net-eth/index.scm:43 backend3/net-eth:214
msgid "Default gateway"
msgstr "Шлюз по умолчанию"
#: ui/net-eth/index.scm:49 backend3/net-eth:218
msgid "Hardware binding"
msgstr "Привязка"
#: ui/net-eth/index.scm:66
msgid "Quit"
msgstr "Выход"
#: backend3/net-eth:57
msgid "missing"
msgstr "отсутствует"
#: backend3/net-eth:58
msgid "by MAC address"
msgstr "по аппаратному адресу (MAC)"
#: backend3/net-eth:59
msgid "by bus location"
msgstr "по расположению на шине"
#: backend3/net-eth:98
msgid "interface is up"
msgstr "интерфейс запущен"
#: backend3/net-eth:98
msgid "interface is down"
msgstr "интерфейс остановлен"
#: backend3/net-eth:103
msgid "plugged"
msgstr "подключен"
#: backend3/net-eth:104
msgid "unplugged"
msgstr "отключен"
#: backend3/net-eth:208
msgid "Interface state"
msgstr "Состояние интерфейса"
#: backend3/net-eth:216
msgid "NetMask"
msgstr "Маска сети"
#: backend3/template-net-eth:31
msgid "IP interfaces administration"
msgstr "Управление IP-интерфейсами"
#: backend3/template-net-eth:32
msgid "Network"
msgstr "Сеть"
alterator-net-eth-0.9/po/uk.po 0000644 0000000 0000000 00000005561 11055303706 0016323 0 ustar 00root root 0000000 0000000 # SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-01-14 12:34+0300\n"
"PO-Revision-Date: 2008-08-27 19:57+0300\n"
"Last-Translator: Michael Shigorin \n"
"Language-Team: Ukrainian \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ui/net-eth/html-messages.scm:1 backend3/template-net-eth:30
msgid "IP interfaces"
msgstr "IP-інтерфейси"
#: ui/net-eth/html-messages.scm:2 ui/net-eth/index.scm:16
msgid "Interface"
msgstr "Інтерфейс"
#: ui/net-eth/html-messages.scm:3
msgid "Select"
msgstr "Вибрати"
#: ui/net-eth/html-messages.scm:4 ui/net-eth/index.scm:55
msgid "Wireless settings"
msgstr "Налаштування бездротових інтерфейсів"
#: ui/net-eth/html-messages.scm:5 ui/net-eth/index.scm:65
msgid "Reset"
msgstr "Скинути"
#: ui/net-eth/html-messages.scm:6 ui/net-eth/index.scm:64
msgid "Apply"
msgstr "Застосувати"
#: ui/net-eth/html-messages.scm:7
msgid "apply current settings and restart interface"
msgstr "застосувати поточні налаштування та рестартувати інтерфейс"
#: ui/net-eth/index.scm:28 backend3/net-eth:210
msgid "Use DHCP"
msgstr "Використовувати DHCP"
#: ui/net-eth/index.scm:33 backend3/net-eth:212
msgid "IP address"
msgstr "IP-адреса"
#: ui/net-eth/index.scm:38
msgid "Netmask"
msgstr "Маска мережі"
#: ui/net-eth/index.scm:43 backend3/net-eth:214
msgid "Default gateway"
msgstr "Типовий шлюз"
#: ui/net-eth/index.scm:49 backend3/net-eth:218
msgid "Hardware binding"
msgstr "Прив'язування"
#: ui/net-eth/index.scm:66
msgid "Quit"
msgstr "Вихід"
#: backend3/net-eth:57
msgid "missing"
msgstr "немає"
#: backend3/net-eth:58
msgid "by MAC address"
msgstr "за MAC-адресою"
#: backend3/net-eth:59
msgid "by bus location"
msgstr "за розміщенням на шині"
#: backend3/net-eth:98
msgid "interface is up"
msgstr "інтерфейс запущено"
#: backend3/net-eth:98
msgid "interface is down"
msgstr "інтерфейс зупинено"
#: backend3/net-eth:103
msgid "plugged"
msgstr "підключено"
#: backend3/net-eth:104
msgid "unplugged"
msgstr "відключено"
#: backend3/net-eth:208
msgid "Interface state"
msgstr "Стан інтерфейсу"
#: backend3/net-eth:216
msgid "NetMask"
msgstr "Маска мережі"
#: backend3/template-net-eth:31
msgid "IP interfaces administration"
msgstr "Керування IP-інтерфейсами"
#: backend3/template-net-eth:32
msgid "Network"
msgstr "Мережа"
alterator-net-eth-0.9/simple.layout 0000644 0000000 0000000 00000000543 11055303706 0017451 0 ustar 00root root 0000000 0000000 (use-modules (alterator transport server-socket)
(alterator transport pipe-channel)
(alterator transport std-channel)
(alterator lookout)
(alterator context)
(alterator atlas))
(telegraph
(pipe-in "/usr/bin/qtbrowser")
;; (std-in)
(lookout)
(ensign))
(with-atlas (load-atlas "simple.smap")
(go))
alterator-net-eth-0.9/simple.smap 0000644 0000000 0000000 00000000111 11055303706 0017063 0 ustar 00root root 0000000 0000000 (include "*.map")
(/ view /net-eth)
(/std/frame view /standalone/frame)
alterator-net-eth-0.9/ui/ 0000755 0000000 0000000 00000000000 11055303706 0015334 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/ui/net-eth/ 0000755 0000000 0000000 00000000000 11055303706 0016700 5 ustar 00root root 0000000 0000000 alterator-net-eth-0.9/ui/net-eth/base-functions.scm 0000644 0000000 0000000 00000000430 11055303706 0022321 0 ustar 00root root 0000000 0000000 (define (base-behaviour)
(ifaces (when selected (update-interface (current-interface))))
(c-button (when clicked (commit-interface "/net-eth" (current-interface))))
(r-button (when clicked (update-interface (current-interface))))
(q-button (when clicked (document:end))))
alterator-net-eth-0.9/ui/net-eth/common-functions.scm 0000644 0000000 0000000 00000004360 11055303706 0022705 0 ustar 00root root 0000000 0000000 (define avail-ifaces (woo-list/name+label "/net-eth"))
(define avail-masks (woo-list/name+label "/net-eth/eth0/avail_masks"))
(define avail-hw-bindings (woo-list/name+label "/net-eth/eth0/avail_hw_bindings"))
(define (update-interface name)
(and (not-empty-string? name)
(let ((cmd (woo-read-first (string-append "/net-eth" "/" name))))
(iface-info text (string-append "(" (woo-get-option cmd 'info) ") "))
(iface-dhcp state (woo-get-option cmd 'dhcp #f) toggled)
(iface-ip text (woo-get-option cmd 'ip))
(iface-mask current (string-list-index (woo-get-option cmd 'mask "24") (map car avail-masks)))
(iface-hw-binding current (string-list-index (woo-get-option cmd 'hw_binding) (map car avail-hw-bindings)))
(w-button activity (woo-get-option cmd 'wireless))
(iface-gw text (woo-get-option cmd 'default)))))
(define (commit-interface path name . args)
(if (or (iface-dhcp state) (not-empty-string? (iface-ip text)))
(and (not-empty-string? name)
(woo-catch/message
(thunk
(apply
woo-write/constraints (string-append path "/" name)
'dhcp (iface-dhcp state)
'ip (iface-ip text)
'mask (current-mask)
'hw_binding (current-hw-binding)
'default (iface-gw text) args))))
#t))
(define (current-interface)
(and (number? (ifaces current))
(>= (ifaces current) 0)
(car (list-ref avail-ifaces (ifaces current)))))
(define (current-mask)
(car (list-ref avail-masks (iface-mask current))))
(define (current-hw-binding)
(car (list-ref avail-hw-bindings (iface-hw-binding current))))
(define (net-wifi name)
(and (not-empty-string? name)
(document:popup "/net-wifi/" 'interface name)))
(define (common-behaviour)
(w-button (when clicked (net-wifi (current-interface))))
(ifaces rows (map cdr avail-ifaces))
(and (positive? (ifaces count))
(begin (ifaces current 0)
(update-interface (current-interface))))
;;constraints
(iface-dhcp (when toggled
((widgets iface-ip
iface-gw
iface-mask)
activity (not (iface-dhcp state)))))
(iface-dhcp toggled))
alterator-net-eth-0.9/ui/net-eth/html-messages.scm 0000644 0000000 0000000 00000000224 11055303706 0022153 0 ustar 00root root 0000000 0000000 (_ "IP interfaces")
(_ "Interface")
(_ "Select")
(_ "Wireless settings")
(_ "Reset")
(_ "Apply")
(_ "apply current settings and restart interface")
alterator-net-eth-0.9/ui/net-eth/index.scm 0000644 0000000 0000000 00000003102 11055303706 0020507 0 ustar 00root root 0000000 0000000 (document:surround "/std/frame")
(document:insert "/std/functions")
(document:insert "/net-eth/common-functions")
(document:insert "/net-eth/base-functions")
(document:insert "/net-eth/install-functions")
(document:envelop with-translation _ "alterator-net-eth")
;;;;;;;;;;;;;;;;;;;;;;;;;
(gridbox
columns "20;20;40;20"
;;
(spacer)
(label (_ "Interface") align "right")
(document:id ifaces (combobox layout-policy 20 -1))
(spacer)
;;
(spacer)
(spacer)
(document:id iface-info (label ""))
(spacer)
;;
(spacer)
(document:id iface-dhcp (checkbox (_ "Use DHCP") widget-name "dhcp"))
(spacer)
(spacer)
;;
(spacer)
(label (_ "IP address") align "right")
(document:id iface-ip (edit "" widget-name "ip"))
(spacer)
;;
(spacer)
(label (_ "Netmask") align "right")
(document:id iface-mask (combobox "" rows (map cdr avail-masks) widget-name "mask"))
(spacer)
;;
(spacer)
(label (_ "Default gateway") align "right")
(document:id iface-gw (edit "" widget-name "default"))
(spacer)
;;
(spacer)
(label (_ "Hardware binding") align "right")
(document:id iface-hw-binding (combobox "" rows (map cdr avail-hw-bindings) widget-name "hw_binding"))
;;
(spacer)
(spacer)
(document:id w-button (button (_ "Wireless settings")))
(spacer)
)
;;;;;;;;;;;;;;;
(or (global 'frame:next)
(hbox align "center"
(document:id c-button (button (_ "Apply")))
(document:id r-button (button (_ "Reset")))
(document:id q-button (button (_ "Quit")))))
;;;;;;;;;;;;;;;;;;
(common-behaviour)
(if (global 'frame:next) (install-behaviour) (base-behaviour))
alterator-net-eth-0.9/ui/net-eth/install-functions.scm 0000644 0000000 0000000 00000002073 11055303706 0023062 0 ustar 00root root 0000000 0000000 (define prev-current (make-cell 0))
(define (prev-interface)
(car (list-ref avail-ifaces (cell-ref prev-current))))
(define (commit-current-interface)
(and (commit-interface "/net-eth" (current-interface) 'restart #f)
(commit-interface "/autoinstall/net-eth" (current-interface) 'restart #f)))
(define (restart-interfaces)
(and (commit-current-interface)
(woo-catch/message
(thunk
(woo-try "restart" "/net-eth")
(woo-try "restart" "/autoinstall/net-eth")))))
(define (install-behaviour)
(ifaces (when selected
(and (commit-interface "/net-eth" (prev-interface) 'restart #f)
(commit-interface "/autoinstall/net-eth" (prev-interface) 'restart #f)
(update-interface (current-interface))
(cell-set! prev-current (ifaces current)))))
(and (global 'frame:auto-save)
(cell-set! (global 'frame:auto-save) commit-current-interface))
(frame:on-back (thunk (or (restart-interfaces) 'cancel)))
(frame:on-next (thunk (or (restart-interfaces) 'cancel))))