From: Emmanuel C. <ma...@us...> - 2007-01-18 21:20:50
|
Update of /cvsroot/zyxel630-11/amedyn/driverconfig In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv24237 Added Files: amedyn_autoconf connectconfig.sh pppoatm_chap-secrets pppoatm_config.sh pppoatm_options pppoatm_pap-secrets Log Message: add some scripts to install the modem easyly --- NEW FILE: connectconfig.sh --- #!/bin/bash function vpi() { vpi="" while [ -z "$vpi" ]; do echo -n "Type in your VPI: " read vpi echo $vpi | grep -E "^[0-9]+$" > /dev/null 2>&1 if [ $? -ne 0 ]; then vpi="" echo -e "** invalid VPI, please enter it again\n" else if [ $vpi -ge 4096 ]; then vpi="" echo -e "** VPI not in range [0-4095], please enter it again\n" fi fi done } function vci() { vci="" while [ -z "$vci" ]; do echo -n "Type in your VCI: " read vci echo $vci | grep -E "^[0-9]+$" > /dev/null 2>&1 if [ $? -ne 0 ]; then vci="" echo -e "** invalid VCI, please enter it again\n" else if [ $vci -ge 65536 ]; then vci="" echo -e "** VCI not in range [0-65535], please enter it again\n" fi fi done } function protocol() { clear while [ !$(true) ] do echo -e "\n-------------------------------------" echo " Protocol Mode Menu " echo "-------------------------------------" echo "[1] RFC1483/2684 routed" echo "[2] PPP over ATM (pppoa)" echo "[3] RFC1483/2684 bridged" echo "[4] PPP over Ethernet (pppoe)" echo "=======================" echo -n "Enter your menu choice, actual $PROTOCOL_MODE. [1-4]: " read PROTOCOL_MODE case $PROTOCOL_MODE in 1) echo "RFC1483/2684 routed" break ;; 2) echo "PPP over ATM (pppoa)" break ;; 3) echo "RFC1483/2684 bridged" break ;; 4) echo "PPP over Ethernet (pppoe)" break ;; *) echo "Opps!!! Please select choice 1,2,3,4"; # echo "Press a key. . ." ; read ;; esac done } function drivermode() { clear while [ !$(true) ] do echo -e "\n-------------------------------------" echo " Driver Mode Menu " echo "-------------------------------------" echo "[1] Classical userspace amedyn (for mainly for 2.4 kernels)" echo "[2] New kernel space driver amedyn2 (experimental)" echo "[3] Updated generic driver usbatm (best for last 2.6 kernels)" echo "=======================" echo -n "Enter your menu choice, actual $PROTOCOL_MODE. [1-3]: " read DRIVER_MODE case $DRIVER_MODE in 1) echo "amedyn" break ;; 2) echo "amedyn2" break ;; 3) echo "xusbatm" break ;; *) echo "Opps!!! Please select choice 1,2,3"; read ;; esac done } function linetype() { clear while [ !$(true) ] do echo -e "\n-------------------------------------" echo " Line Type Menu " echo "-------------------------------------" echo "[1] Analogical" echo "[2] ISDN" echo "=======================" echo -n "Enter your menu choice, actual $PROTOCOL_MODE. [1-2]: " read linetype case $linetype in 1) echo "analogical" line=0x15 break ;; 2) echo "ISDN" line=0x11 break ;; *) echo "Opps!!! Please select choice 1,2"; read ;; esac done } function modem() { clear while [ !$(true) ] do echo -e "\n-------------------------------------" echo " Modem Menu " echo "-------------------------------------" echo "[1] 0x06b9/0xa5a5 : Zyxel Prestige 630-11, Zyxel Prestige 630-13, Topcom Webracer 851, ..." echo "[2] 0x0b05/0x6206 : Asus AAM600UG" echo "[3] 0x1767/0x0005 : Medi@com 103/MADSLU" echo "=======================" echo -n "Enter your menu choice, actual $PROTOCOL_MODE. [1-3]: " read modemtype case $modemtype in 1) echo "0x06b9/0xa5a5" vid=0x06b9 pid=0xa5a5 break ;; 2) echo "0x0b05/0x6206" vid=0x0b05 pid=0x6206 break ;; 3) echo "0x1767/0x0005" vid=0x1767 pid=0x0005 break ;; *) echo "Opps!!! Please select choice 1,2 or 3"; read ;; esac done } clear echo -e "\n===== Welcome to the driver configuration tool for the Alcatel Dynamite USB modem ship based =====\n" echo -e "At any time, press Ctrl+C to quit this script without saving modifications.\n" echo -n "Do you want to set your connection setting by using this script (Y/n) ? " read ans if [[ "$ans" = "n" || "$ans" = "N" ]] then exit 0 fi resync=0 NETMASK=255.255.255.0 modem linetype protcol drivermode protocol vpi vci clear if [[ "$PROTOCOL_MODE" = 1 || "$PROTOCOL_MODE" = 3 ]]; then echo -e "\n-------------------------------------" echo " For or RFC1483/2684 routed/bridged " echo -e "-------------------------------------\n" echo -n "Enter IP address (If you left it blank in bridged mode, then it will use DHCP to get IP), actual IP_ADDRESS : " read IP_ADDRESS echo -n "Enter the network mask (If you left if blank 255.255.255.0 will bu used), actual NETMASK : " read NETMASK if [ "$NETMASK" = "" ] then NETMASK=255.255.255.0 fi echo -n "Enter the gateway IP, actual GATEWAY : " read GATEWAY fi echo -e "\nWriting configuration to file... " while [ $(echo " # # Config file for Zyxel 630-11 & Asus AAM6000UG (ADSL Modem USB) # # Line type # 0x15 = ANALOG # 0x11 = ISDN LINE_TYPE=\"$line\" # Driver mode # 1 = amedyn # 2 = amedyn2 # 3 = xusbatm DRIVER_MODE=$DRIVER_MODE # Protocol # 1 = RFC1483/2684 routed # 2 = PPP over ATM (pppoa) # 3 = RFC1483/2684 bridged # 4 = PPP over Ethernet (pppoe) PROTOCOL_MODE=$PROTOCOL_MODE # xusbatm VENDOR=\"$vid\" # 0x06b9 / 0x0b05 / 0x1767 PRODUCT=\"$pid\" # 0xa5a5 / 0x6206 / 0x0005 RX_ENDPOINT=\"0x87\" TX_ENDPOINT=\"0x07\" RX_ALTSETTING=1 TX_ALTSETTING=1 # Paths BINARY_PATH=\"/usr/sbin\" ATM_PATH=\"\" # ATM VPI=$vpi VCI=$vci # Specific for RFC1483/2684 routed/bridged # if IP_ADDRESS is blank in bridged mode then it uses DHCP to get IP IP_ADDRESS=$IP_ADDRESS NETMASK=$NETMASK GATEWAY=$GATEWAY # === Re-sync modem line if line goes down # - don't resync on line down = 0 # - resync when line goes down = 1 RESYNC=$resync " > ./etc/amedyn) ] do echo -e "\nERROR writing config to file" echo -n "Try again ? (Y/n) : " read ans if [[ "$ans" = "n" || "$ans" = "N" ]] then exit -1 fi done if [[ "$PROTOCOL_MODE" = 2 ]]; then ./pppoatm_config.sh fi echo "done" --- NEW FILE: pppoatm_chap-secrets --- # Secrets for authentication using CHAP # client server secret IP addresses user_name@provider * password * --- NEW FILE: pppoatm_options --- lock # # If something goes wrong try uncommenting this # debug kdebug 1 # # Makes this ppp link the default inet route # (route -n to check it) # defaultroute # # We don't need a default ip # noipdefault # # Asks your ISP for its DNS ip # (look at the /etc/ppp/resolv.conf) # usepeerdns noauth sync # # We don't want to negociate compression schemes at all # #noaccomp #nopcomp noccp novj holdoff 4 # # Makes pppd "dial again" when the connection is lost # persist # # pppd will try to connect "maxfail"(0=all-the-time) times and wait "holdoff" seconds # between each try. # holdoff 4 maxfail 0 passive asyncmap 0 lcp-echo-interval 2 lcp-echo-failure 7 # # pppd will try to connect "maxfail" times and wait "holdoff" seconds # between each try. # holdoff 4 maxfail 25 name user_name@provider user user_name@provider # # Requires the PPP Over ATM plugin # plugin pppoatm VPI.VCI --- NEW FILE: pppoatm_config.sh --- #!/bin/bash function user_name() { user="" while [ -z "$user" ]; do echo -n "Type in your user name (given by your provider): " read user done } function provider() { provider="" while [ -z "$provider" ]; do echo -n "Type in your provider name (by example tiscali.be): " read provider done } function password() { pwdmatch=0 while [ $pwdmatch -eq 0 ]; do stty -echo password1="" while [ -z "$password1" ]; do echo -n "Type in your password (given by your provider): " read password1 echo done password2="" while [ -z "$password2" ]; do echo -n "Type in your password again (for verification): " read password2 echo done stty echo if [ "$password1" == "$password2" ]; then pwdmatch=1 else echo -e "** passwords don't match, try again\n" fi done } function dns() { dns1="" while [ -z "$dns1" ]; do echo -n "Type in an IP for DNS1: " read dns1 echo $dns1 | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1 if [ $? -ne 0 ]; then dns1="" echo -e "** invalid IP for DNS1, please retry\n" fi done echo dns2="" while [ -z "$dns2" ]; do echo -n "Type in an IP for DNS2: " read dns2 echo $dns2 | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1 if [ $? -ne 0 ]; then dns2="" echo -e "** invalid IP for DNS2, please retry\n" fi done } function vpi() { vpi="" while [ -z "$vpi" ]; do echo -n "Type in your VPI: " read vpi echo $vpi | grep -E "^[0-9]+$" > /dev/null 2>&1 if [ $? -ne 0 ]; then vpi="" echo -e "** invalid VPI, please enter it again\n" else if [ $vpi -ge 4096 ]; then vpi="" echo -e "** VPI not in range [0-4095], please enter it again\n" fi fi done } function vci() { vci="" while [ -z "$vci" ]; do echo -n "Type in your VCI: " read vci echo $vci | grep -E "^[0-9]+$" > /dev/null 2>&1 if [ $? -ne 0 ]; then vci="" echo -e "** invalid VCI, please enter it again\n" else if [ $vci -ge 65536 ]; then vci="" echo -e "** VCI not in range [0-65535], please enter it again\n" fi fi done } function pppoatm() { pppoatm="" pppoatm=$(find /usr/lib/pppd | grep pppoatm | head -n1) } function summary() { echo "==== Configuration will be created with these values :" echo echo " + User : $user" echo " + Password : (hidden)" echo " + Provider : $provider" # echo " DNS 1 : $dns1" # echo " DNS 2 : $dns2" echo " + pppoatm : $pppoatm" echo " VPI/VCI : $vpi/$vci" } function secret() { for auth in "chap" "pap" do secretfile="./$auth-secrets" if [ -s $secretfile ] then backup "$secretfile" echo -n "modifying $secretfile.. " TMP=$(echo "$username" | sed "s/\\\/\\\\\\\\\\\/g") grep -v -E "^[ \t]*\"?$TMP\"?[ \t]*.*\n?" $backupfile > "$secretfile" else echo -n "creating $secretfile.. " echo "# Secrets for authentication using $auth" > "$secretfile" fi echo -e "\"$user\"\t*\t\"$password1\"\t*" >> "$secretfile" echo "OK" done } function write_config() { sed -e "s:pppoatm:$pppoatm:g" -e "s/VCI/$vci/g" -e "s/VPI/$vpi/g" -e "s/user_name/$user/g" -e "s/provider/$provider/g" pppoatm_options > options sed -e "s/user_name/$user/g" -e "s/provider/$provider/g" -e "s/password/$password1/g" pppoatm_pap-secrets > pap-secrets sed -e "s/user_name/$user/g" -e "s/provider/$provider/g" -e "s/password/$password1/g" pppoatm_chap-secrets > chap-secrets } echo echo "Enter now your VPI/VCI (depending on your provider/country)" echo "Example for BELGIUM: 8 35 (VPI=8, VCI=35)" echo "These values correspond to the number dialed under Windows." echo vpi vci user_name provider password clear pppoatm summary write_config cp pap-secrets /etc/pap-secrets cp chap-secrets /etc/chap-secrets cp options /etc/options rm pap-secrets chap-secrets options echo "DONE!" --- NEW FILE: amedyn_autoconf --- # # Config file for Zyxel 630-11 & Asus AAM6000UG (ADSL Modem USB) # # Line type # 0x15 = ANALOG # 0x11 = ISDN LINE_TYPE="0x15" # Driver mode # 1 = amedyn # 2 = amedyn2 # 3 = xusbatm DRIVER_MODE=3 # Protocol # 1 = RFC1483/2684 routed # 2 = PPP over ATM (pppoa) # 3 = RFC1483/2684 bridged # 4 = PPP over Ethernet (pppoe) PROTOCOL_MODE=2 # xusbatm VENDOR="0x1767" # 0x06b9 / 0x0b05 / 0x1767 PRODUCT="0x0005" # 0xa5a5 / 0x6206 / 0x0005 RX_ENDPOINT="0x87" TX_ENDPOINT="0x07" RX_ALTSETTING=1 TX_ALTSETTING=1 # Paths BINARY_PATH="/usr/sbin" ATM_PATH="" # ATM VPI=8 VCI=35 # Specific for RFC1483/2684 routed/bridged # if IP_ADDRESS is blank in bridged mode then it uses DHCP to get IP IP_ADDRESS= NETMASK=255.255.255.0 GATEWAY= # === Re-sync modem line if line goes down # - don't resync on line down = 0 # - resync when line goes down = 1 RESYNC=0 --- NEW FILE: pppoatm_pap-secrets --- # Secrets for authentication using PAP # client server secret IP addresses user_name@provider * password * |