PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Transparent Inter Process Communication"
NAME="tipcutils"
TIPCCONFIG="/sbin/tipc-config"
MODULE=/lib/modules/`uname -r`/kernel/net/tipc/tipc.ko
[ -e "$MODULE" ] || exit 0
[ -x "$TIPCCONFIG" ] || exit 0
[ -e "/etc/default/$NAME" ] || exit 0
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
start_interfaces()
{
INTERFACES=`/sbin/ifconfig -a | sed -e '/^[^ ]/ { s/^\([^ ]*\).*$/\1/; p; }; d;'`
for IF in $INTERFACES
do
for TIPC_IF in $TIPC_INTERFACES
do
if [ $TIPC_IF = $IF ]; then
IFACE=$IF /etc/network/if-up.d/$NAME
fi
done
done
}
start_tipc()
{
echo Starting TIPC
if [ -n "$TIPC_NETID" ]; then
test "$TIPC_VERBOSITY" = 1 && echo modprobe -q tipc
if ! modprobe -q tipc; then
echo "Error configuring TIPC, loading the kernel module failed!"
exit 0
fi
test "$TIPC_VERBOSITY" = 1 && echo $TIPCCONFIG -netid="$TIPC_NETID"
if ! $TIPCCONFIG -netid="$TIPC_NETID"; then
echo "Error configuring TIPC, setting the nedid to $TIPC_NETID failed!"
exit 0
fi
fi
if [ -n "$TIPC_REMOTE_MANAGEMENT" ]; then
test "$TIPC_VERBOSITY" = 1 && echo $TIPCCONFIG -mng="$TIPC_REMOTE_MANAGEMENT"
if [ "$TIPC_REMOTE_MANAGEMENT" = "true" ] || [ "$TIPC_REMOTE_MANAGEMENT" = "enable" ]; then
TIPC_REM_MGMNT="enable"
else
TIPC_REM_MGMNT="disable"
fi
if ! $TIPCCONFIG -mng="$TIPC_REM_MGMNT"; then
echo "Error configuring TIPC, setting the remote management to \"$TIPC_REM_MGMNT\" failed!"
exit 0
fi
fi
if [ -n "$TIPC_ADDR" ]; then
test "$TIPC_VERBOSITY" = 1 && echo $TIPCCONFIG -addr="$TIPC_ADDR"
if ! $TIPCCONFIG -addr="$TIPC_ADDR"; then
echo "Error configuring TIPC, setting the address to \"$TIPC_ADDR\" failed!"
exit 0
fi
fi
start_interfaces
}
stop_tipc()
{
( lsmod |grep -q tipc ) && rmmod tipc
}
case "$1" in
start)
if [ "$TIPC_CONFIGURED" != "true" ]; then
echo TIPC is not configured in \"/etc/default/$NAME\".
echo To configure TIPC, run \`dpkg-reconfigure -plow tipcutils\`!
exit 0
fi
start_tipc
;;
stop)
stop_tipc
;;
restart|force-reload)
stop_tipc
start_tipc
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
: