#!/bin/sh [ $(uname -r|sed 's/^2\.6\.//;s/\..*$//') -le 19 ] && cifsd_suffix="notifyd" DAEMON=cifsmount DAEMON_CHECK="cifsoplockd cifsd$cifsd_suffix" . /etc/init.d/modlibrc # works only with applet seq enabled: #CIFSMOUNT_LIST=$(seq 1 $CIFSMOUNT_COUNT) CIFSMOUNT_LIST="1" i=1 while [ "$i" -lt "$CIFSMOUNT_COUNT" ]; do let i++ CIFSMOUNT_LIST="$CIFSMOUNT_LIST $i" done start() { echo -n 'Starting cifs ... ' exitval=0 CIFSMNT_PATH=/sbin modprobe cifs [ "$?" -gt 0 ] && exitval=1 for i in $CIFSMOUNT_LIST; do eval CIFSMOUNT_SHARE=\$CIFSMOUNT_SHARE$i eval CIFSMOUNT_MOUNTPOINT=\$CIFSMOUNT_MOUNTPOINT$i eval CIFSMOUNT_USER=\$CIFSMOUNT_USER$i eval CIFSMOUNT_PASS=\$CIFSMOUNT_PASS$i if [ -n "$CIFSMOUNT_MOUNTPOINT" ]; then echo "mount $CIFSMOUNT_SHARE ..." mkdir -p "$CIFSMOUNT_MOUNTPOINT" $CIFSMNT_PATH/mount.cifs $CIFSMOUNT_SHARE $CIFSMOUNT_MOUNTPOINT -o user="$CIFSMOUNT_USER",pass="$CIFSMOUNT_PASS" [ "$?" -gt 0 ] && exitval=1 fi done if [ "$exitval" -eq 0 ]; then echo 'done.' else echo 'failed.' exit $exitval fi } stop() { exitval=0 for i in $CIFSMOUNT_LIST; do eval CIFSMOUNT_SHARE=\$CIFSMOUNT_SHARE$i eval CIFSMOUNT_MOUNTPOINT=\$CIFSMOUNT_MOUNTPOINT$i eval CIFSMOUNT_USER=\$CIFSMOUNT_USER$i eval CIFSMOUNT_PASS=\$CIFSMOUNT_PASS$i if [ -n "$CIFSMOUNT_MOUNTPOINT" ]; then echo "unmount $CIFSMOUNT_SHARE ..." umount $CIFSMOUNT_MOUNTPOINT [ "$?" -gt 0 ] && exitval=1 #rmdir $CIFSMOUNT_MOUNTPOINT fi done rmmod cifs 2>/dev/null return $exitval } case $1 in ""|load) modreg cgi cifsmount 'cifsmount' modreg daemon $DAEMON modlib_start $CIFSMOUNT_ENABLED ;; unload) modunreg daemon $DAEMON modunreg cgi cifsmount modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2 exit 1 ;; esac exit 0