Script d'installation du paquetage "i4l"


#!/bin/sh
#
# install/doinst.sh - to be done after extraction
#
# Copyright (c) 1997 S.u.S.E. GmbH Fuerth, Germany.
#
#
echo "check SuSE Version and updating etc/rc.config..."
# wenn es noch keine 6.x ist
#
# dank an werner für diesen code ;)))
#
if [ -f etc/SuSE-release ] ; then
  while read line ; do
    case "$line" in
        VERSION*) break ;;
        *)              ;;
    esac
  done < etc/SuSE-release
else
  # use 5.3 for anything older
  line="VERSION = 5.3"
fi
line=${line##*=}
major=${line%.*}
minor=${line##*.}
# if ! test ${line%.*} -ge 6 -a ${line#*.} -ge 0 ; then
if ! test $major -ge 6 ; then
	if [ -x bin/fillup ] ; then
		if ! [ -d etc/rc.config.d ] ; then
			mkdir -p etc/rc.config.d
		fi
		echo -n "setting up i4l."
		
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_ID/I4L_ID/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_TYPE/I4L_TYPE/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_IRQ/I4L_IRQ/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_MEMBASE/I4L_MEMBASE/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_PORT/I4L_PORT/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_IO0/I4L_IO0/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_IO1/I4L_IO1/g" > etc/rc.config
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | sed -e "s/I4L_TELES_MODUL_OPTIONS/I4L_MODUL_OPTIONS/g" > etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_b1.templ etc/rc.config.d/i4l_b1.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_default.templ etc/rc.config.d/i4l_default.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_hisax.templ etc/rc.config.d/i4l_hisax.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_icn.templ etc/rc.config.d/i4l_icn.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_option.templ etc/rc.config.d/i4l_option.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		fillup -t -r -i etc/rc.config var/adm/fillup-templates/i4l_sp_option.templ etc/rc.config.d/i4l_sp_option.rc.config
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo -n "."
		# all unknown I4L variable from /etc/rc.config
		# move to /etc/rc.config.d/i4l_unknown
		touch etc/rc.config.d/i4l_unknown
		echo -n "."
		mv etc/rc.config etc/rc.config.old
		cat etc/rc.config.old | grep "^I4" >> etc/rc.config.d/i4l_unknown
		echo -n "."
		cat etc/rc.config.old | grep -v "^I4" > etc/rc.config.new
		echo -n "."
		mv etc/rc.config.new etc/rc.config
		echo "done"
	else
		echo "ERROR: fillup not found. This should not happen. Please compare"
		echo "etc/rc.config.d/* and var/adm/fillup-templates/i4l*"
		echo "and update by hand."
	fi
fi
# Update for pre 6.4 versions or new install templates.
if test ! -e etc/rc.config.d/i4l_hardware.rc.config ; then
    if test -e etc/rc.config.d/i4l_hisax.rc.config ; then
	mv etc/rc.config.d/i4l_hisax.rc.config etc/rc.config.d/i4l_hisax.rc.config.old
	cat etc/rc.config.d/i4l_hisax.rc.config.old | \
	    sed -e "s/I4L_TYPE=/I4L_TYPE_1=/g; \
		s/I4L_SUBTYPE=/I4L_SUBTYPE_1=/g; \
		s/I4L_ID=/I4L_ID_1=/g; \
		s/I4L_MEMBASE=/I4L_MEMBASE_1=/g; \
		s/I4L_IRQ=/I4L_IRQ_1=/g; \
		s/I4L_PORT=/I4L_IO_1=/g; \
		s/I4L_IO0=/I4L_IO0_1=/g; \
		s/I4L_IO1=/I4L_IO1_1=/g; \
		s/I4L_MODUL_OPTIONS=/I4L_MODUL_OPTIONS_1=/g" > \
		etc/rc.config.d/i4l_hisax.rc.config.tmp
	if test -e etc/rc.config.d/i4l_default.rc.config ; then
	    mv etc/rc.config.d/i4l_default.rc.config etc/rc.config.d/i4l_default.rc.config.tmp
	    grep "I4L_PROTOCOL=" etc/rc.config.d/i4l_default.rc.config.tmp | \
		sed -e "s/I4L_PROTOCOL=/I4L_PROTOCOL_1=/g" >> \
		    etc/rc.config.d/i4l_hisax.rc.config.tmp
	    grep -v "I4L_PROTOCOL=" etc/rc.config.d/i4l_default.rc.config.tmp > \
		    etc/rc.config.d/i4l_default.rc.config
	fi
	if test -e etc/rc.config.d/i4l_sp_option.rc.config ; then
	    mv etc/rc.config.d/i4l_sp_option.rc.config etc/rc.config.d/i4l_sp_option.rc.config.tmp
	    grep "I4L_HISAXDEBUG=" etc/rc.config.d/i4l_sp_option.rc.config.tmp | \
		sed -e "s/I4L_HISAXDEBUG=/I4L_HISAXDEBUG_1=/g" >> \
		    etc/rc.config.d/i4l_hisax.rc.config.tmp
	    grep -v "I4L_HISAXDEBUG=" etc/rc.config.d/i4l_sp_option.rc.config.tmp > \
		    etc/rc.config.d/i4l_sp_option.rc.config
	fi
	source etc/rc.config.d/i4l_hisax.rc.config.tmp
	if test -e etc/rc.config.d/i4l_b1.rc.config ; then
	    mv etc/rc.config.d/i4l_b1.rc.config etc/rc.config.d/i4l_b1.rc.config.old
	    if test -z $I4L_TYPE_1 ; then
		source etc/rc.config.d/i4l_b1.rc.config.old
		if test "$I4L_USE_B1" = "yes" ; then
		    new="I4L_TYPE_1=\"8001\""
		    sub=`grep "I4L_TYPE_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    I4L_SUBTYPE_1="0"
		    if test "$I4L_USE_B1_PCI" = "yes" ; then
			I4L_SUBTYPE_1="1"
		    fi
		    if test "$I4L_USE_B1_PCMCIA" = "yes" ; then
			I4L_SUBTYPE_1="2"
                    fi
		    if test "$I4L_USE_C4_PCI" = "yes" ; then
			I4L_SUBTYPE_1="3"
                    fi
		    new="I4L_SUBTYPE_1=\"$I4L_SUBTYPE_1\""
		    sub=`grep "I4L_SUBTYPE_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    new="I4L_IRQ_1=\"$I4L_B1_IRQ_1\""
		    sub=`grep "I4L_IRQ_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    new="I4L_IO_1=\"$I4L_B1_IO_1\""
		    sub=`grep "I4L_IO_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    test -z $I4L_B1_PROTOCOLL_1 && I4L_B1_PROTOCOLL_1="2"
		    new="I4L_PROTOCOL_1=\"$I4L_B1_PROTOCOLL_1\""
		    sub=`grep "I4L_PROTOCOL_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    source etc/rc.config.d/i4l_hisax.rc.config.tmp
		fi
	    fi
	fi
	if test -e etc/rc.config.d/i4l_icn.rc.config ; then
	    mv etc/rc.config.d/i4l_icn.rc.config etc/rc.config.d/i4l_icn.rc.config.old
	    if test -z $I4L_TYPE_1 ; then
		source etc/rc.config.d/i4l_icn.rc.config.old
		test -z "$I4L_ICN_ID" && I4L_ICN_ID="$I4l_ICN_ID"
		if test ! -z "$I4L_ICN_ID" ; then
		    new="I4L_TYPE_1=\"8030\""
		    sub=`grep "I4L_TYPE_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    I4L_SUBTYPE_1="0"
	    	    test -z "$I4L_ICN_ID2" && I4L_ICN_ID2="$I4l_ICN_ID2"
		    if test ! -z "$I4L_ICN_ID2" ; then
			I4L_SUBTYPE_1="1"
		    fi
		    new="I4L_SUBTYPE_1=\"$I4L_SUBTYPE_1\""
		    sub=`grep "I4L_SUBTYPE_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    new="I4L_ID_1=\"$I4L_ICN_ID\""
		    sub=`grep "I4L_ID_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
	    	    test -z "$I4L_ICN_PORT" && I4L_ICN_PORT="$I4l_ICN_PORT"
		    new="I4L_IO_1=\"$I4L_ICN_PORT\""
		    sub=`grep "I4L_IO_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
	    	    test -z "$I4L_ICN_MEMBASE" && I4L_ICN_MEMBASE="$I4l_ICN_MEMBASE"
		    new="I4L_MEMBASE_1=\"$I4L_ICN_MEMBASE\""
		    sub=`grep "I4L_MEMBASE_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    test -z $I4L_ICN_PROTOCOLL && I4L_ICN_PROTOCOLL="2"
		    new="I4L_PROTOCOL_1=\"$I4L_ICN_PROTOCOLL\""
		    sub=`grep "I4L_PROTOCOL_1=" etc/rc.config.d/i4l_hisax.rc.config.tmp`
		    cat etc/rc.config.d/i4l_hisax.rc.config.tmp | \
		    sed -e "s/$sub/$new/g" > etc/rc.config.d/i4l_hisax.rc.config.temp
		    mv etc/rc.config.d/i4l_hisax.rc.config.temp etc/rc.config.d/i4l_hisax.rc.config.tmp
		    source etc/rc.config.d/i4l_hisax.rc.config.tmp
		fi
	    fi
	fi
	fillup -t -r -i etc/rc.config.d/i4l_hisax.rc.config.tmp \
	    var/adm/fillup-templates/i4l_hardware.templ \
	    etc/rc.config.d/i4l_hardware.rc.config
    else
	cp var/adm/fillup-templates/i4l_hardware.templ etc/rc.config.d/i4l_hardware.rc.config
    fi
fi
#
# update 6 and postprocess prior 6 update 
# install templates, if installation from scratch
#
if test ! -e etc/rc.config.d/i4l.rc.config ; then
    if test -e etc/rc.config.d/i4l_option.rc.config ; then
	mv etc/rc.config.d/i4l_option.rc.config etc/rc.config.d/i4l_option.rc.config.old
	cat etc/rc.config.d/i4l_option.rc.config.old > etc/rc.config.d/i4l.rc.config.tmp
	if test -e etc/rc.config.d/i4l_sp_option.rc.config ; then
	    mv etc/rc.config.d/i4l_sp_option.rc.config etc/rc.config.d/i4l_sp_option.rc.config.old
	    cat etc/rc.config.d/i4l_sp_option.rc.config.old >> etc/rc.config.d/i4l.rc.config.tmp
        fi
        if test -e etc/rc.config.d/i4l_default.rc.config ; then
	    mv etc/rc.config.d/i4l_default.rc.config etc/rc.config.d/i4l_default.rc.config.old
	    cat etc/rc.config.d/i4l_default.rc.config.old >> etc/rc.config.d/i4l.rc.config.tmp
        fi
        if test -s etc/rc.config.d/i4l_unknown ; then
	    mv etc/rc.config.d/i4l_unknown etc/rc.config.d/i4l_unknown.old
	    cat etc/rc.config.d/i4l_unknown.old >> etc/rc.config.d/i4l.rc.config.tmp
        fi
        fillup -t -r -i etc/rc.config.d/i4l.rc.config.tmp \
	    var/adm/fillup-templates/i4l.templ \
	    etc/rc.config.d/i4l.rc.config
	if test -s etc/rc.config.d/i4l.rc.config.tmp.new ; then
	    mv etc/rc.config.d/i4l.rc.config.tmp.new etc/rc.config.d/i4l.rc.config.tmp
	    fillup -t -r -i etc/rc.config.d/i4l.rc.config.tmp \
		var/adm/fillup-templates/i4l_rc.templ \
		etc/rc.config.d/rc.config.add
	    if test -s etc/rc.config.d/rc.config.add ; then
		fillup -t etc/rc.config etc/rc.config.d/rc.config.add etc/rc.config.tmp
		mv etc/rc.config.tmp etc/rc.config
	    fi
	fi
	if test -s etc/rc.config.d/i4l.rc.config.tmp.new ; then
	    mv etc/rc.config.d/i4l.rc.config.tmp.new etc/rc.config.d/i4l.rc.config.tmp
	    fillup -t -r -i etc/rc.config.d/i4l.rc.config.tmp \
		var/adm/fillup-templates/i4l_ignore.templ \
		etc/rc.config.d/i4l.rc.config.temp
	    rm etc/rc.config.d/i4l.rc.config.temp
	fi
	if test -s etc/rc.config.d/i4l.rc.config.tmp.new ; then
	    grep "^I4L" etc/rc.config.d/i4l.rc.config.tmp.new > \
		etc/rc.config.d/i4l_unknown
	fi
    else
	cp var/adm/fillup-templates/i4l.templ etc/rc.config.d/i4l.rc.config
	cat var/adm/fillup-templates/i4l_rc.templ >> etc/rc.config
    fi
fi
if test -e etc/isdn/isdn.conf ; then
    if ! grep "^VBN" etc/isdn/isdn.conf >>/dev/null ; then
	echo "VBN = 010">>etc/isdn/isdn.conf
	echo "VBNLEN = 2:3">>etc/isdn/isdn.conf
    fi
    if ! grep "^PRESELECTED" etc/isdn/isdn.conf >>/dev/null ; then
	echo "PRESELECTED=33">>etc/isdn/isdn.conf
    fi
fi
touch etc/rc.config.d/i4l_unknown
## send mail to root
mkdir -p var/adm/notify/messages
cat << EOT > var/adm/notify/messages/i4l-notify
Changes regarding configuration of ISDN (I4L)
-----------------------------------------------------------
All parameters previously located in /etc/rc.config and 
/etc/rc.config.d/i4l_XXXXX.rc.config have been moved to 
/etc/rc.config.d/i4l_hardware.rc.config and
/etc/rc.config.d/i4l.rc.config
I4L parameters which where not normally include in
/etc/rc.config are now in /etc/rc.config.d/i4l_unknown,
including all parameters regarding the configuration
of more than 4 ISDN-Interfaces (I4L_XXXX_4).
Please move these manually to the appropriate
i4l.rc.config file, so that YaST is able to
find them. You only need to do this, if you currently 
have more than 4 ISDN interfaces configured.
The changes were nessesary for future enhancements
(eg. to use more as one card, configure active cards with yast too)
Have fun!
Änderungen bei der Konfiguration von ISDN (I4L)
-----------------------------------------------------------
Alle Variablen aus /etc/rc.config und /etc/rc.config.d/i4l*
sind der Übersicht halber in 2 neue Dateien 
/etc/rc.config.d/i4l_hardware.rc.config und
/etc/rc.config.d/i4l.rc.config
verschoben worden.
I4L Variablen, die nicht standardmäßig in den rc.config's
waren, finden Sie in /etc/rc.config.d/i4l_unknown.
Dazu gehören auch alle Variablen die Sie bei mehr als
4 ISDN-Interfaces brauchen (I4L_*_4).
Verschieben Sie diese bitte per Hand in die entsprechenden
Dateien unter /etc/rc.config.d/i4l.rc.config, damit YaST
diese auch bearbeiten kann.
Die Änderungen wurden notwendig um in Zukunft mehrere ISDN
Karten einfach zu unterstützen und auch aktive Karten mit yast
zu konfigurieren.
-----------------------------------------------------------
EOT
exit 0


(c) SuSE - Dernière mise à jour: 31.03.2000 12:55;