#!/bin/sh export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/mod/sbin:/mod/bin:/mod/usr/sbin:/mod/usr/bin export LD_LIBRARY_PATH=/mod/lib DAEMON=/mod/etc/cifs_mount DAEMON_UMOUNT=/mod/etc/cifs_umount case "$1" in ""|load|start|restart) if [ ! -r "/mod/etc/conf/cifsmount.cfg" ]; then echo "Error[cifsmount]: not configured" 1>&2 exit 1 fi . /mod/etc/conf/cifsmount.cfg ;; esac start() { ( if [ -x /tmp/flash/cifs_mount ]; then /tmp/flash/cifs_mount else /mod/etc/default.cifsmount/cifs_mount fi ) > /mod/etc/cifs_mount ( if [ -x /tmp/flash/cifs_umount ]; then /tmp/flash/cifs_umount else /mod/etc/default.cifsmount/cifs_umount fi ) > /mod/etc/cifs_umount echo -n 'mount cifs...' chmod +x $DAEMON $DAEMON_UMOUNT $DAEMON > /dev/null 2>&1 exitval=$? if [ "$exitval" -eq 0 ]; then echo 'done.' else echo 'failed.' exit $exitval fi } stop() { echo -n 'unmount cifs...' $DAEMON_UMOUNT sleep 1 if [ -z "$(pidof cifsoplockd)" -a -z "$(pidof cifsdnotifyd)" ]; then echo 'done.' else echo 'failed.' exit 1 fi } case "$1" in ""|load) if type modreg > /dev/null; then modreg cgi cifsmount 'cifsmount' fi if [ "$CIFSMOUNT_ENABLED" != "yes" ]; then echo "cifsmount is disabled" 1>&2 exit 1; fi if [ ! -z "$(pidof "cifsoplockd")" -a ! -z "$(pidof "cifsdnotifyd")" ]; then echo "cifsmount already started." else start fi ;; unload) stop modunreg cgi cifsmount ;; start) start ;; stop) stop ;; restart) stop sleep 1 start ;; status) if [ -z "$(pidof "cifsoplockd")" -a -z "$(pidof "cifsdnotifyd")" ]; then echo 'stopped' else echo 'running' fi ;; *) echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2 exit 1 ;; esac exit 0