68 lines
1.2 KiB
Bash
Executable File
68 lines
1.2 KiB
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
START=97
|
|
|
|
ENABLED=0
|
|
WORKGROUPD=0
|
|
IOCHARSET=0
|
|
GUEST=""
|
|
USERS=""
|
|
AGM=""
|
|
|
|
cifs_header() {
|
|
local enabled
|
|
local workgroup
|
|
|
|
config_get enabled $1 enabled
|
|
config_get workgroup $1 workgroup
|
|
|
|
ENABLED=$enabled
|
|
WORKGROUPD=$workgroup
|
|
}
|
|
|
|
mount_natshare() {
|
|
local server
|
|
local name
|
|
local natpath
|
|
local guest
|
|
local users
|
|
local pwd
|
|
local agm
|
|
local iocharset
|
|
local smbver
|
|
|
|
config_get server $1 server
|
|
config_get name $1 name
|
|
config_get natpath $1 natpath
|
|
config_get guest $1 guest
|
|
config_get users $1 users
|
|
config_get pwd $1 pwd
|
|
config_get agm $1 agm
|
|
config_get iocharset $1 iocharset
|
|
config_get smbver $1 smbver
|
|
|
|
mkdir -p $natpath && chmod 777 $natpath
|
|
#echo "mount -t cifs -o vers=$smbver,user=$users,password=$pwd,iocharset=$iocharset,$agm //$server/$name $natpath"
|
|
mount -t cifs -o vers=$smbver,user=$users,password=$pwd,iocharset=$iocharset,$agm //$server/$name $natpath
|
|
}
|
|
|
|
start() {
|
|
config_load cifs
|
|
config_foreach cifs_header cifs
|
|
|
|
if [ $ENABLED == 1 ]
|
|
then {
|
|
config_foreach mount_natshare natshare
|
|
#echo "Cifs Mount succeed."
|
|
}
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
mount | grep '//' | awk -F ' ' '{print$3}' | while read line; do
|
|
#echo "umount -d -l $line"
|
|
umount -d -l $line 2>/dev/null
|
|
done
|
|
}
|
|
|