alterator-net-eth-0.9/000075500000000000000000000000001105530370600147175ustar00rootroot00000000000000alterator-net-eth-0.9/Makefile000064400000000000000000000006521105530370600163620ustar00rootroot00000000000000NAME=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/000075500000000000000000000000001105530370600174055ustar00rootroot00000000000000alterator-net-eth-0.9/applications/net-eth.desktop000064400000000000000000000003771105530370600223530ustar00rootroot00000000000000[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/000075500000000000000000000000001105530370600163715ustar00rootroot00000000000000alterator-net-eth-0.9/backend3/net-eth000075500000000000000000000124411105530370600176650ustar00rootroot00000000000000#!/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-eth000075500000000000000000000012521105530370600214740ustar00rootroot00000000000000#!/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/000075500000000000000000000000001105530370600156475ustar00rootroot00000000000000alterator-net-eth-0.9/help/ru_RU/000075500000000000000000000000001105530370600167035ustar00rootroot00000000000000alterator-net-eth-0.9/help/ru_RU/net-eth.html000064400000000000000000000037711105530370600211450ustar00rootroot00000000000000 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/000075500000000000000000000000001105530370600166535ustar00rootroot00000000000000alterator-net-eth-0.9/help/uk_UA/net-eth.html000064400000000000000000000025451105530370600211130ustar00rootroot00000000000000 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/000075500000000000000000000000001105530370600156635ustar00rootroot00000000000000alterator-net-eth-0.9/html/fbi/000075500000000000000000000000001105530370600164235ustar00rootroot00000000000000alterator-net-eth-0.9/html/fbi/net-eth.html000064400000000000000000000035021105530370600206550ustar00rootroot00000000000000 IP interfaces - ALT Linux Console