king_stiven
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору #!/bin/sh #loading driver for accessing Windows shares insmod /mtd_rwarea/SamyGO/modules/cifs.ko #creating and mounting shares from Windows server VUSB="/dtv/usb/sda4" #this will be root directory for all shares SERVER="192.168.0.158" #this is server with shares USER=user #Windows PC username which should see share's contents PASS= #in my case password is not needed #list of shares SHARE1=Films #if share server is down, we do not connect shares #if we do - it will cause shutdown problems ping -c 1 $SERVER #pinging shares server if [ "$?" = "0" ] ; then #if ping was successful #make shares root directory mkdir -p $VUSB #make all shares directories and mount resources to them i=1 while [ $i -le 20 ] #increase it if you have more than 20 shares do share_name="SHARE${i}" eval share=\$${share_name} #exit cycle on empty variable if [ -z $share ]; then break fi #make empty directory for share mounting mkdir "$VUSB/$share" #mount shared resource to newly created folder mount -o user=$USER,password=$PASS -t cifs "//$SERVER/$share" "$VUSB/$share" #evaluating next value i=`expr $i + 1` done #showing shares through virtual USB #don't know what happens here or is it effective way, but it works dd if=/dev/zero of=/dtv/vusb bs=512 count=4 insmod /mtd_rwarea/SamyGO/modules/dummy_hcd.ko sleep 2 insmod /mtd_rwarea/SamyGO/modules/g_file_storage.ko sleep 3 #you can change "PC" below to other name if you wish. it will be presented on TV echo -e "[sda] Vendor : CifsMount Product : PC Serial : Q80VQLFH Devpath : 8 Lun : 0 MountDir : /dtv/usb/sda4 FileSystem : vfat " >> /dtv/usb/log else echo "Server is not reachable. Will not mount shares" fi |