Technical data

8. Documentation for Developers
Miscellaneous
mk_writable <File>: Ensures that the given file is writable. If the file is located on a volume
mounted in read-only mode and is only linked to the file system via a symbolic link, a
local copy will be created which is then written to.
unique <List>: Removes duplicates from a list passed. The result is returned in the variable
list.
8.7.4. ttyI Devices
For ttyI devices (/dev/ttyI0 . . . /dev/ttyI15) used by the “modem emulation” of the ISDN
card a counter exists to avoid conflicts between multiple packages using these devices. For
this purpose the file /var/run/next_ttyI is created on router start which can be queried and
incremented by the OPTs. The following example script can query this value, increment it by
one and export it again for the next OPT.
ttydev_error=
ttydev=$(cat /var/run/next_ttyI)
if [ $ttydev -le 16 ]
then # ttyI device available? yes
ttydev=$((ttydev + 1)) # ttyI device + 1
echo $ttydev >/var/run/next_ttyI # save it
else # ttyI device available? no
log_error "No ttyI device for <Name of your OPT> available!"
ttydev_error=true # set error for later use
fi
if [ -z "$ttydev_error" ] # start OPT only if next tty device
then # was available to minimize error
... # messages and minimize the
# risk of uncomplete boot
fi
8.7.5. Dialin And Hangup Scripts
General
After dialin resp. hangup of a dial-up connection the scripts placed in /etc/ppp/ are executed.
OPTs may store actions here that have to be executed after connecting resp. hanging up of a
connection. The name scheme for the files is as follows:
ip-up<three-digit number>.<OPT-Name>
ip-down<three-digit number>.<OPT-Name>
ip-up scripts will be excuted after establishing and ip-down scripts after hangig up of the
connection.
Important: In ip-down scripts no actions may be taken that lead to another dialin because
this would create a permanent-online condition not desired for users without a flatrate.
335