Zaptel /etc/init.d script question

Hi Forum,

When loading zaptel modules I see this section which is in the “start” section of the script.

        for x in $MODULES; do 
                eval localARGS="\$${x}_ARGS"
                if modprobe ${x} ${ARGS} ${localARGS} >& /dev/null; then
                        echo -n " $x"
                fi
        done
  1. Is $MODULES coming from /etc/sysconfig/zaptel
  2. Where can one set the localARGS, for instance for the wctdm module when it is loaded? I take it this is what $${x}_ARGS allows me to do.

My background isn’t bash scripting but know enough to be dangerous, so be careful :wink:

Thanks for your help

Hi,

Monday morning, just putting this post back into view for ppl.

Thanks
Mylo

On my debian machine the path to the file is:
/etc/default/zaptel

The lines that you are interested in are:

MODULES="$MODULES wctdm"
wctdm_ARGS=“opermode=BULGARIA”

There you go.
I hope this helps.

In debian this should go in /etc/default/zaptel
In other systems this should go in /etc/sysconfig/zaptel

MODULES="wcte11xp wctdm"
wctdm_ARGS="opermode=AUSTRALIA"
TELEPHONY=“yes”

This part of /etc/init.d/zaptel reads your configuration

Source zaptel configuration.

if [ $system = debian ]; then
[ -f /etc/default/zaptel ] && . /etc/default/zaptel
LOCKFILE=/var/lock/zaptel
elif [ $system = redhat ]; then
[ -f /etc/sysconfig/zaptel ] && . /etc/sysconfig/zaptel
LOCKFILE=/var/lock/subsys/zaptel
fi

This part of /etc/init.d/zaptel does the trick

    for x in $MODULES; do
            eval localARGS="\$${x}_ARGS"
            if modprobe ${x} ${ARGS} ${localARGS} 2> /dev/null; then
                    echo -n " $x"
                    echo "."
            fi
    done

=============================================

Give this a bash in bash:
x=wctdm
wctdm_ARGS=“opermode=AUSTRALIA"
eval localARGS=”$${x}_ARGS"
echo $localARGS

This should echo opermode=AUSTRALIA

This allows you to leave the zaptel init script as is. :smiley:

Hi,
I never noticed that facility in the init scripts…

Another way of doing it is to use the ‘options’ facility in /etc/modprobe.conf, adding an options line somewhere before the module install line, like:

options wctdm opermode=UK install wctdm /sbin/modprobe --ignore-install wctdm && /sbin/ztcfg options wctdm8xxp opermode=UK install wctdm8xxp /sbin/modprobe --ignore-install wctdm8xxp && /sbin/ztcfg options wctdm24xxp opermode=UK install wctdm24xxp /sbin/modprobe --ignore-install wctdm24xxp && /sbin/ztcfg