In some email I received from Young, Darren, sie wrote:
> I'm getting an error on boot when the pfil script fires:
> 
> /etc/rcS.d/S10pfil: expr: not found
> /etc/rcS.d/S10pfil: test: argument expected
> 
> Tried adding -x to the pfil script but have been unable to track down
> what the problem is... Something to do with the way filesystems are
> mounted in the single user run level?

Yes.

I've attached the latest startup script that should be immune to this
problem and it is found in the latest pfil .tar.gz available for download.

Darren
#!/bin/sh
PFILAP=/etc/opt/pfil/iu.ap

fixif()
{
        ifconfig $1 2>/dev/null 1>&2
        if [ $? -ne 0 ] ; then
                ifconfig $1 plumb
                ifconfig $1 unplumb
        fi
}

fixtun()
{
        # Unfortunately tunnels are implemented using
        # a streams modules, not a device driver so
        # autopush isn't of much help.  The current
        # approach is to see if /usr/bin exists in
        # which case it's late enough in the game
        # to plumb the tunnel and modinsert pfil.

        ifname="$1"

        if [ -d /usr/bin ] ; then
                ifconfig $ifname plumb
                set -- `ifconfig $ifname modlist`
                pos=""
                while [ $# -ge 2 -a -z "$pos" ]
                        do
                                case "$2" in
                                        tun) pos="$1"
                                                ;;
                                        pfil) return
                                                ;;
                                        *)
                                                ;;
                                esac
                                shift 2
                        done
                if [ -n "$pos" ] ; then
                        ifconfig $ifname modinsert [EMAIL PROTECTED]
                fi
        fi
}


case "$1" in
        start)
                if [ ! -f /etc/ipf.conf -a ! -f /etc/opt/ipf/ipf.conf ] ; then
                        exit 0;
                fi
                iflist="`echo /etc/hostname.*[0-9] 2>/dev/null`"
                if [ "$iflist" != '/etc/hostname.*[0-9]' ] ; then
                        (
                                y=xxx
                                x=$IFS
                                for i in /etc/hostname.*[0-9]; do
                                        ORIGIFS="$IFS"
                                        IFS="$IFS.:"
                                        set -- $i
                                        IFS="$ORIGIFS"
                                        case "$2" in
                                                # Handle tunnels
                                                ip|ip6) ifname="$2.$3"
                                                        fixtun $ifname
                                                        continue
                                                        ;;
                                                # Normal interfaces
                                                *) ifname="$2"
                                                        ;;
                                        esac
                                        if [ $ifname != $y ] ; then
                                                y=$ifname
                                                fixif $ifname
                                        fi
                                done
                        )
                fi
                echo > /dev/pfil
                autopush -f ${PFILAP} 2>/dev/null 1>&2
                ;;

        *)
                echo "Usage: $0 start" >&2
                exit 1
                ;;

esac
exit 0

Reply via email to