Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37571567
en ru br
Репозитории ALT
S:0.10-alt1
5.1: 0.9-alt1
4.1: 0.6.1-alt2.M41.3
4.0: 0.4.4-alt3
+updates:0.4.3-alt1
www.altlinux.org/Changes

Группа :: Система/Настройка/Прочее
Пакет: alterator-net-pppoe

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

alterator-net-pppoe-0.9/000075500000000000000000000000001132417670100152645ustar00rootroot00000000000000alterator-net-pppoe-0.9/Makefile000064400000000000000000000001751132417670100167270ustar00rootroot00000000000000NAME=net-pppoe

INSTALL=/usr/bin/install

all:
clean:
install: install-module

include /usr/share/alterator/build/module.mak
alterator-net-pppoe-0.9/applications/000075500000000000000000000000001132417670100177525ustar00rootroot00000000000000alterator-net-pppoe-0.9/applications/net-pppoe.desktop000064400000000000000000000004471132417670100232610ustar00rootroot00000000000000[Desktop Entry]
Type=Application
Categories=X-Alterator-Network
Icon=net-pppoe
Terminal=false
Name=PPPoE connections
X-Alterator-URI=/net-pppoe
X-Alterator-Help=net-pppoe
Name[ru]=PPPoE-я│п╬п╣п╢п╦п╫п╣п╫п╦я▐
Name[uk]=PPPoE-п╥'я■п╢п╫п╟п╫п╫я▐
Name[pt_BR]=PPPoE Conexц╣es
Name[es]=PPPoE conecciones
alterator-net-pppoe-0.9/backend3/000075500000000000000000000000001132417670100167365ustar00rootroot00000000000000alterator-net-pppoe-0.9/backend3/net-pppoe000075500000000000000000000062571132417670100206050ustar00rootroot00000000000000#!/bin/sh -f

wait_time=3
alterator_api_version=1

. alterator-sh-functions
. alterator-net-functions
. alterator-hw-functions

### shell file helpers

read_connection()
{
local name="/etc/net/ifaces/$1"

local info=
netdev_is_up "$1" && info="`_ "connection established"`" || info="`_ "connection failed"`"
write_string_param info "$info"

local iface="$(read_iface_option "$name" HOST)"
[ -n "$iface" ] || iface="$(list_eth|head -n1)"

write_string_param iface "$iface"
write_string_param login "$(read_ppp_option "$name" user)"

write_bool_param 'mppe' "$(read_ppp_option1 "$name" 'require-mppe' 'nomppe')"
}

write_connection()
{
[ "$1" = "/" ] && return
local name="/etc/net/ifaces/$1"

[ -d "$name" ] || mkdir -- "$name"

[ -n "$in_iface" ] && write_iface_option "$name" HOST "$in_iface"

[ -n "$in_login" ] && write_ppp_option "$name" user "$in_login"
[ -n "$in_password" ] && write_ppp_option "$name" password "$(echo "$in_password"|sed -e 's/["]/\\\\&/g')"

test_bool "$in_mppe"
write_ppp_option1 "$name" 'require-mppe' 'nomppe' "$?"
}

new_connection()
{
local name="/etc/net/ifaces/$1"

mkdir -p -- "$name"

write_iface_option "$name" TYPE ppp
write_iface_option "$name" ONBOOT yes
write_iface_option "$name" PPPTYPE pppoe
write_iface_option "$name" PPPPERSIST on
write_iface_option "$name" PPPMAXFAIL 0

# https://bugzilla.altlinux.org/show_bug.cgi?id=15603
cat>"$name/pppoptions"<<EOF
defaultroute
mtu 1476
usepeerdns
EOF
chmod o-rw "$name/pppoptions" # deny others reading the password
}

delete_connection()
{
[ "$1" = "/" ] && return
local name="/etc/net/ifaces/$1"

iface_down "$1"
rm -rf -- "$name"
}

iface_up_priv()
{
local iface="$1";shift
local n="${1:-0}";shift

env -i PATH="$PATH" HOME="$HOME" TMPDIR="$TMPDIR" /usr/bin/setsid /sbin/ifup "$iface" >/dev/null
for i in $(seq 0 "$n"); do
netdev_is_up "$iface" && return 0
[ "$i" != "$n" ] || sleep 1
done
return 1
}

on_message()
{
case "$in_action" in
list)
case "$in__objects" in
avail_connection)
list_ppp 'pppoe'|write_enum
;;
avail_iface)
list_eth|write_enum
;;
avail_state)
write_enum_item "ignore" "`_ "don't change"`" #'
write_enum_item "start" "`_ "start"`"
write_enum_item "stop" "`_ "stop"`"
write_enum_item "restart" "`_ "restart"`"
;;
esac
;;
read)
local name="$in_name"
[ -n "$in_new" ] && name="$in_new_name"
[ -n "$name" ] || name="$(list_ppp 'pppoe'|head -n1)"

write_string_param new_name "$(next_ppp)"
write_string_param name "$name"
write_string_param status "ignore"
[ -n "$name" ] && read_connection "$name"
;;
write)
if [ -n "$in_new" -a -n "$in_new_name" ];then
new_connection "$in_new_name"
elif [ -n "$in_delete" -a -n "$in_name" ];then
delete_connection "$in_name"
elif [ -n "$in_commit" -a -n "$in_name" ];then
write_connection "$in_name"
case "$in_status" in
start) iface_up_priv "$in_name" "$wait_time" ;;
stop) iface_down "$in_name" "$wait_time" ;;
restart)
iface_down "$in_name" "$wait_time"
iface_up "$in_name" "$wait_time"
;;
esac
fi
;;
esac
}

message_loop
alterator-net-pppoe-0.9/ui/000075500000000000000000000000001132417670100157015ustar00rootroot00000000000000alterator-net-pppoe-0.9/ui/net-pppoe/000075500000000000000000000000001132417670100176105ustar00rootroot00000000000000alterator-net-pppoe-0.9/ui/net-pppoe/ajax.scm000064400000000000000000000042451132417670100212440ustar00rootroot00000000000000(define-module (ui net-pppoe ajax)
:use-module (alterator ajax)
:use-module (alterator woo)
:export (on-load))

(define (ui-update-activity)
(let* ((name (form-value "name"))
(active (and (string? name)
(not (string=? "" name)))))
(form-update-activity "info" active)
(form-update-activity "status" active)
(form-update-activity "iface" active)
(form-update-activity "login" active)
(form-update-activity "password" active)
(form-update-activity "mppe" active)
(form-update-activity "apply_button" active)
(form-update-activity "reset_button" active)
(form-update-activity "del_button" active)))

(define (init-iface)
(form-update-enum "iface" (woo-list "/net-pppoe/avail_iface"))
(form-update-enum "status" (woo-list "/net-pppoe/avail_state" 'language (form-value "language"))))

(define (read-current-iface)
(read-iface (or (form-value "name") "")))

(define (read-iface name)
(catch/message
(lambda()
(let ((data (woo-read-first "/net-pppoe/" 'name name 'language (form-value "language"))))

(form-update-enum "name" (woo-list "/net-pppoe/avail_connection"))
(form-update-value "password" "")
(form-update-value-list '("name"
"new_name"
"info"
"status"
"iface"
"login"
"mppe")
data)))))

(define (write-iface)
(catch/message
(lambda()
(apply woo-write "/net-pppoe" 'commit #t (form-value-list))
(read-iface (form-value "name")))))

(define (new-iface)
(catch/message
(lambda()
(let ((new_name (form-value "new_name")))
(woo-write "/net-pppoe" 'new #t 'new_name new_name)
(read-iface new_name)
(ui-update-activity)))))

(define (delete-iface)
(catch/message
(lambda()
(woo-write "/net-pppoe/" 'delete #t 'name (or (form-value "name") ""))
(read-iface "")
(ui-update-activity))))

(define (on-load)
(form-bind "new_button" "click" new-iface)
(form-bind "del_button" "click" delete-iface)

(form-bind "apply_button" "click" write-iface)
(form-bind "reset_button" "click" read-current-iface)
(form-bind "name" "change" read-current-iface)

(init-iface)
(read-current-iface)
(ui-update-activity))
alterator-net-pppoe-0.9/ui/net-pppoe/index.html000064400000000000000000000030651132417670100216110ustar00rootroot00000000000000<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html wf="none">
<body>
<form method="POST">
<table>
<tr>
<input type="hidden" name="new_name"/>
<input type="button" name="new_button" value="New connection..." class="btn"/>
<br/>
<hr/>
</tr>
<tr>
<td>
<select name="name" size="17" style="width:100px"/>
</td>
<td>
<table class="form-table">
<tr>
<td><span translate="_">Status:</span></td>
<td>
<span class="alterator-label" name="info"/>
<select name="status"/>
</td>
</tr>
<tr>
<td><span translate="_">Interface:</span></td>
<td><select name="iface"/></td>
</tr>
<tr>
<td><span translate="_">Account:</span></td>
<td><input type="text" class="text" name="login"/></td>
</tr>
<tr>
<td><span translate="_">Password:</span></td>
<td><input type="password" class="text" name="password"/></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="checkbox" name="mppe" value="#t"/>
<span translate="_">MPPE encryption</span>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="button" name="apply_button" value="Apply" class="btn"/>
<input type="button" name="reset_button" value="Reset" class="btn"/>
&nbsp;&nbsp;
<input type="button" name="del_button" value="Delete connection" class="btn"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
alterator-net-pppoe-0.9/ui/net-pppoe/index.scm000064400000000000000000000020761132417670100214300ustar00rootroot00000000000000(document:surround "/std/frame")

(edit visibility #f name "new_name")
(gridbox
columns "100"
margin 10

(button text (_ "New connection...") align "left" name "new_button")
(separator)

(splitbox
columns "30;70"
(listbox name "name")
(gridbox
columns "0;100"
;;
(label text (_ "Status:") align "right")
(hbox align "left"
(label name "info")
(combobox name "status"))
;;
(label text (_ "Interface:") align "right" name "iface")
(combobox name "iface")
;;
(label text (_ "Account:") align "right" name "login")
(edit name "login")
;;
(label text (_ "Password:") align "right" name "password")
(edit echo "stars" name "password")
;;
(spacer)
(checkbox text (_ "MPPE encryption") name "mppe")
;;
(label colspan 2)
;;
(spacer)
(hbox
align "left"
(button text (_ "Apply") name "apply_button")
(button text (_ "Reset") name "reset_button")
(label text " ")
(button text (_ "Delete connection") name "del_button")))))

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin