#!/bin/sh # Net-install configures DHCP/ADSL, Winmodem and HSP modems # Markku (Rasatmakananda) # Date: 29 November 2003 ANSWER="/tmp/.modem" TITLE="Net & Modem installer" # install stages S_NET=0 S_SELECT=0 KVER="$(uname -r)" case "$KVER" in 2.6.*) VER="2.6" ;; esac case "$KVER" in 2.4.*) VER="2.4" ;; esac [ `id -u` -ne 0 ] && { echo "This program must be run by the root user" echo " Login root:" echo " # su" echo " # " exit 1 } abort() { dodialog yesno "Exit Installation?" 6 40 && exit 0 return 0 } msg() { dodialog msgbox "$1" return 1 } dodialog() { # use this for msgbox, inputbox, yesnobox, infobox # # dodialog [height] [width] [other] height=0 width=0 if [ "$3" != "" ]; then height=$3 fi if [ "$4" != "" ]; then width=$4 fi dialog --backtitle "$TITLE" --aspect 15 --$1 "$2" $height $width $5 } domenu() { menutype=$1 ; shift text=$1 ; shift height=$1 ; shift width=$1 ; shift mheight=$1 ; shift dialog --backtitle "$TITLE" --$menutype "$text" $height $width $mheight $* } donetwork() { if [ -f /tmp/.hwd ]; then msg "This will do the configuration for DHCP or ADSL" dodialog yesno "Do you want to use DHCP?" if [ $? -eq 0 ]; then modprobe dummy dhcpcd eth0 msg "The network is configured." else dodialog yesno "Do you want to setup ADSL connection?" 8 50 || return 0 adsl-setup msg "Trying to connect (adsl-start)...." adsl-start echo "Press any key to continue...." read KEY if [ -f /var/run/pppoe.conf-adsl.pid.start ]; then msg "The network is configured." return 0 else msg "The network is NOT configured!!" fi fi else msg "Run hwd (hardware detect) before configuring the network." fi S_NET=1 } wizard() { dodialog yesno "Puppy Linux's modem wizard runs in GUI only. If in KDE, press Yes." 8 60 || return 0 /usr/bin/modem-wizard } cm8738() { dodialog yesno "You have selected HSP cm8738 modem. To continue press Yes." 6 60 || return 0 msg "This will install pctel and ptserial module to your system. Ignore the error message." mknod /dev/ttyS15 c 62 79 chmod a+rw /dev/ttyS15 ln -sf /dev/ttyS15 /dev/modem insmod -f /etc/hwd/modem/hsp/cm8738/pctel.o insmod -f /etc/hwd/modem/hsp/cm8738/ptserial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } i8xx() { dodialog yesno "You have selected HSP i8xx modem. To continue press Yes." 6 60 || return 0 msg "This will install pctel and ptserial module to your system. Ignore the error message." mknod /dev/ttyS15 c 62 79 chmod a+rw /dev/ttyS15 ln -sf /dev/ttyS15 /dev/modem insmod -f /etc/hwd/modem/hsp/i8xx/pctel.o insmod -f /etc/hwd/modem/hsp/i8xx/ptserial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } pct789() { dodialog yesno "You have selected HSP pct789 modem. To continue press Yes." 6 60 || return 0 msg "This will install pctel and ptserial module to your system. Ignore the error message." mknod /dev/ttyS15 c 62 79 chmod a+rw /dev/ttyS15 ln -sf /dev/ttyS15 /dev/modem insmod -f /etc/hwd/modem/hsp/pct789/pctel.o insmod -f /etc/hwd/modem/hsp/pct789/ptserial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } sis() { dodialog yesno "You have selected HSP sis modem. To continue press Yes." 6 60 || return 0 msg "This will install pctel and ptserial module to your system. Ignore the error message." mknod /dev/ttyS15 c 62 79 chmod a+rw /dev/ttyS15 ln -sf /dev/ttyS15 /dev/modem insmod -f /etc/hwd/modem/hsp/sis/pctel.o insmod -f /etc/hwd/modem/hsp/sis/ptserial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } via686a() { dodialog yesno "You have selected HSP via686a modem. To continue press Yes." 6 60 || return 0 msg "This will install pctel and ptserial module to your system. Ignore the error message." mknod /dev/ttyS15 c 62 79 chmod a+rw /dev/ttyS15 ln -sf /dev/ttyS15 /dev/modem insmod -f /etc/hwd/modem/hsp/via686a/pctel.o insmod -f /etc/hwd/modem/hsp/via686a/ptserial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } winmodem() { if [ "$VER" = "2.6" ]; then msg "Winmodem configure for kernel 2.4.x only. You are currently using $VER" else dodialog yesno "You have selected Winmodem (LTmodem). To continue press Yes." 6 60 || return 0 msg "This will install lt_modem and lt_serial module to your system. Ignore the error message." mknod /dev/ttyLT0 c 62 64 chmod a+rw /dev/ttyLT0 ln -sf /dev/ttyLT0 /dev/modem insmod -f /cdrom/system/lib/modules/2.4.24/ltmodem/lt_modem.o insmod -f /cdrom/system/lib/modules/2.4.24/ltmodem/lt_serial.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi fi } usbmodem() { # This USB modem script is not included. msg "This is an experimental USB modem configure and may freeze the sceen when dialing with Kppp (KDE dialer)." dodialog yesno "This will install modules for Aztech UM-9100-U modem and may work for other USB modems as well.To continue press Yes." 8 60 || return 0 msg "This will install slusb module to your system and creates /dev/modem link. Ignore the error message." mknod -m 666 /dev/ttySL0 c 212 0 chmod a+rw /dev/ttySL0 ln -sf /dev/ttySL0 /dev/modem insmod -f /cdrom/system/lib/modules/2.4.22/misc/slusb.o if [ -a /dev/modem ]; then msg "The modules were successfully installed." msg "Open 'KPPP (Internet Dial-up Tool)' and configure /dev/modem. Query modem . If the modem connects then setup an account." else msg "Modules were NOT installed!!!." fi } mainmenu() { dialog --backtitle "$TITLE" --title "MAIN MENU" \ --menu "Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." 14 55 6 \ "1" "Network" \ "2" "HSP modems" \ "3" "Winmodem" \ "4" "Modem Wizard" \ "5" "Exit" 2>$ANSWER EDITOR= case `cat $ANSWER` in "1") donetwork ;; "2") if [ "$VER" = "2.6" ]; then msg "HSP modem configure for kernel 2.4.x only. You are currently using $VER" || return 0 fi DONE=0 while [ "$DONE" = "0" ]; do dialog --backtitle "$TITLE" --menu "Select HSP modem type." 15 55 7 \ "1" "cm8738" \ "2" "i8xx" \ "3" "pct789" \ "4" "sis" \ "5" "via686a" \ "6" "Return to Main Menu" 2>$ANSWER case `cat $ANSWER` in "1") cm8738 ;; "2") i8xx ;; "3") pct789 ;; "4") sis ;; "5") via686a ;; *) DONE=1 ;; esac done ;; "3") winmodem ;; "4") wizard ;; "5") abort ;; esac } dodialog msgbox "This installer configures network, internal modem (Winmodem and HSP modem). External serial modem doesn't require to configure. To use this installer run through the options in the order they are presented." 9 60 loop() { while `/bin/true`; do mainmenu done } loop exit 0