#!/bin/sh

getarg1()
{
    echo $1
}

getstrmmods()
{
    /sbin/lsmod | grep "^streams-" | \
    while read line; do
        echo -n "`getarg1 $line` "
    done
}

if /sbin/lsmod | grep -q "^streams"; then
    # Detach from all files
    /usr/sbin/fdetach -a
fi

strmmods=`getstrmmods`
if [ "$strmmods..." != "..." ]; then
    if ! modprobe -r $strmmods ; then
	echo "Could not unload module(s): ${strmmods}."
    fi
fi

modprobe -r streams
exit $?
