#!/bin/bash # ISA PnP Modem Configuration Utility version 0.1 # 1998 Jared D. McNeill APPMAJORVERSION="0" APPMINORVERSION="1" TMP=/var/log/setup/tmp # Check to see if the user is root. if [ ! $UID = "0" ]; then echo echo "You need to be UID 0 (root) to run this script." echo exit 1 fi # Check for 'dialog' utility if ! type -all "dialog" 1>/dev/null 2>&1 ; then echo echo "You need the dialog utility to run this script." echo "dialog: http://www.tux.org/pub/people/kent-robotti/" echo exit 1 fi # Check for 'isapnp' utility if ! type -all "isapnp" 1>/dev/null 2>&1 ; then echo echo "You need isapnptools to run this script." echo "isapnptools: http://www.roestock.demon.co.uk/isapnptools/" echo exit 1 fi # Check for 'pnpdump' utility if ! type -all "pnpdump" 1>/dev/null 2>&1 ; then echo echo "You need isapnptools to run this script." echo "isapnptools: http://www.roestock.demon.co.uk/isapnptools/" echo exit 1 fi echo "ISA PnP Modem Configuration Utility $APPMAJORVERSION.$APPMINORVERSION" > $TMP/pnptemp001 echo >> $TMP/pnptemp001 echo "Written by Jared D. McNeill " >> $TMP/pnptemp001 echo >> $TMP/pnptemp001 echo "Press [ENTER] to continue with setup.." >> $TMP/pnptemp001 dialog --backtitle "ISA PnP Modem Configuration Utility" \ --textbox "$TMP/pnptemp001" 9 73 echo "To begin setting up your Plug and Play modem, I need to know a few" > $TMP/pnptemp001 echo "things." >> $TMP/pnptemp001 echo >> $TMP/pnptemp001 echo "What com port is your modem on?" >> $TMP/pnptemp001 echo "Example: COM1 in MSDOS/Windows is /dev/ttyS0 in Linux" >> $TMP/pnptemp001 echo " COM2 in MSDOS/Windows is /dev/ttyS1 in Linux" >> $TMP/pnptemp001 echo " COM3 in MSDOS/Windows is /dev/ttyS2 in Linux" >> $TMP/pnptemp001 echo " COM4 in MSDOS/Windows is /dev/ttyS3 in Linux" >> $TMP/pnptemp001 echo >> $TMP/pnptemp001 dialog --backtitle "ISA PnP Modem Configuration Utility" \ --inputbox "`cat $TMP/pnptemp001`" 16 73 2> $TMP/pnptempCOM COMPORT="`cat $TMP/pnptempCOM`" echo "I am now going to setup a base /etc/isapnp.conf" > $TMP/pnptemp001 echo "Please enter the name of your favorite editor" >> $TMP/pnptemp001 echo >>$TMP/pnptemp001 dialog --backtitle "ISA PnP Modem Configuration Utility" \ --inputbox "`cat $TMP/pnptemp001`" 8 73 "pico" 2> $TMP/pnptempTXT EDITOR="`cat $TMP/pnptempTXT`" if ! type -all "$EDITOR" 1>/dev/null 2>&1 ; then echo echo "Text editor not found! Setup cancelled!" echo exit 1 fi echo "You will now need to setup your /etc/isapnp.conf" > $TMP/pnptemp001 echo "Scroll down until you see something like this:" >> $TMP/pnptemp001 echo "# Card 1: (serial identifier 27 ff ff ff ff 68 18 73 16)" >> $TMP/pnptemp001 echo "# Vendor Id , No Serial Number (-1), checksum 0x27." >> $TMP/pnptemp001 echo "The SOMETHING should be the type of modem that you have." >> $TMP/pnptemp001 echo "Below that you should see something like this:" >> $TMP/pnptemp001 echo "# (IO 0 (BASE 0x3F8))" >> $TMP/pnptemp001 echo "# (INT 0 (IRQ 3 (MODE +E)))" >> $TMP/pnptemp001 echo "# (ACT Y)" >> $TMP/pnptemp001 echo "You will need to uncomment those three lines and set the BASE" >> $TMP/pnptemp001 echo "and the IRQ to what your modem uses. Standard values are:" >> $TMP/pnptemp001 echo "/dev/ttyS0 (COM1) io 0x3F8 irq 4" >> $TMP/pnptemp001 echo "/dev/ttyS1 (COM2) io 0x2F8 irq 3" >> $TMP/pnptemp001 echo "/dev/ttyS1 (COM3) io 0x3E8 irq 4" >> $TMP/pnptemp001 echo "/dev/ttyS1 (COM4) io 0x2E8 irq 3" >> $TMP/pnptemp001 dialog --backtitle "ISA PnP Modem Configuration Utility" \ --textbox "$TMP/pnptemp001" 21 73 if [ -r /etc/isapnp.conf ]; then cp -f /etc/isapnp.conf /etc/isapnp.conf.orig fi pnpdump > /etc/isapnp.conf $EDITOR /etc/isapnp.conf echo "Hopefully your isapnp.conf is setup properly." > $TMP/pnptemp001 echo "Go try it out and see if it works." >> $TMP/pnptemp001 echo >> $TMP/pnptemp001 echo "This setup will be added to /etc/rc.d/rc.local so it is" >> $TMP/pnptemp001 echo "started at boot. Good luck!" >> $TMP/pnptemp001 dialog --backtitle "ISA PnP Modem Configuration Utility" \ --textbox "$TMP/pnptemp001" 8 73 clear isapnp /etc/isapnp.conf setserial $COMPORT auto_irq autoconfig echo >> /etc/rc.d/rc.local echo "# Added by ISA PnP Modem Configuration Utility" >> /etc/rc.d/rc.local echo "# `date`" >> /etc/rc.d/rc.local echo "isapnp /etc/isapnp.conf" >> /etc/rc.d/rc.local echo "setserial $COMPORT auto_irq autoconfig" >> /etc/rc.d/rc.local echo echo "ISA PnP Modem Configuration Utility $APPMAJORVERSION.$APPMINORVERSION by Jared D. McNeill" exit 1