File: //usr/syno/etc/rc.sysv/synomount.sh
#!/bin/sh
. /etc.defaults/rc.subr
SYNOMOUNT=/usr/syno/bin/synomount
BOOTSEQ=/usr/syno/bin/synobootseq
LoadModule()
{
local MODULE=$1
if [ -z "$MODULE" ]; then
return 1;
fi
shift;
if lsmod | grep -q "^$MODULE\>"; then
return 0;
fi
echo "Load ${MODULE}.ko ... "
modprobe ${MODULE} "$@" > /dev/null 2>&1
}
RemoveModule()
{
local MODULE=$1
if [ -z "$MODULE" ]; then
return 1;
fi
if ! lsmod | grep -q "^$MODULE\>"; then
return 0;
fi
echo "Remove ${MODULE}.ko ..."
rmmod $MODULE
}
SYNOMountAllBooting()
{
$SYNOMOUNT --all
while true;
do
if $BOOTSEQ --is-ready > /dev/null 2>&1; then
$SYNOMOUNT --all
break
fi
sleep 10
if $BOOTSEQ --is-shutdown > /dev/null 2>&1; then
break
fi
done
}
start()
{
# <DSM> #147781 - put loop.ko into linux kernel projects to load early
LoadModule isofs
LoadModule udf
if $BOOTSEQ --is-ready >/dev/null 2>&1; then
$SYNOMOUNT --resume &
else
SYNOMountAllBooting &
fi
}
stop()
{
$SYNOMOUNT --umountall
RemoveModule udf
RemoveModule isofs
RemoveModule cifs
}
case "$1" in
start) start ;;
stop) stop ;;
*) ;;
esac