Automatically mount smb folders for N900 when connected to a specific network
A week after purchasing the Nokia n900 phone, there was a desire to make it so that when I came home and connected to my network, my phone automatically mounted the folder from the laptop that did not turn off for the night.
Solution:
To connect the smb folder with support for Russian names, do the following:
1. Install two packages:
2. Under root, execute two commands:
3. Create a folder in which the section will be mounted:
4. Create a script at the address /etc/network/if-up.d/ called 00_mount_notebook_upload with the following contents:
5. At the address /etc/network/if-down.d/ create a script by disconnecting the folder when disconnected from the network under the name 00_umount_notebook_upload with the following contents:
Instead of parameters in <> specify your data.
6. Set permissions for scripts:
7. Reconnect the network connection and check for files in the mounted folder.
Solution:
To connect the smb folder with support for Russian names, do the following:
1. Install two packages:
- kernel-module-nls-utf8 - kernel-module-cifs
2. Under root, execute two commands:
echo start on startup > /etc/event.d/cifs
echo exec modprobe cifs >> /etc/event.d/cifs
* This source code was highlighted with Source Code Highlighter.
3. Create a folder in which the section will be mounted:
mkdir /home/user/MyDocs/mountpoints
mkdir /home/user/MyDocs/mountpoints/notebook-upload
* This source code was highlighted with Source Code Highlighter.
4. Create a script at the address /etc/network/if-up.d/ called 00_mount_notebook_upload with the following contents:
#!/bin/sh
set -e
ICD_CONNECTION_NAME=$(gconftool-2 -g "/system/osso/connectivity/IAP/$ICD_CONNECTION_ID/name")
if [ "$IFACE" = wlan0 ]; then
if [ "$ICD_CONNECTION_NAME" = "" ]; then
mount -t cifs /// /home/user/MyDocs/mountpoints/notebook-upload/ -o user=,pass=,ip=,codepage=cp1251,iocharset=utf8
fi
fi
* This source code was highlighted with Source Code Highlighter.
5. At the address /etc/network/if-down.d/ create a script by disconnecting the folder when disconnected from the network under the name 00_umount_notebook_upload with the following contents:
#!/bin/sh
set -e
ICD_CONNECTION_NAME=$(gconftool-2 -g "/system/osso/connectivity/IAP/$ICD_CONNECTION_ID/name")
if [ "$IFACE" = wlan0 ]; then
if [ "$ICD_CONNECTION_NAME" = "" ]; then
umount /home/user/MyDocs/mountpoints/notebook-upload/
fi
fi
* This source code was highlighted with Source Code Highlighter.
Instead of parameters in <> specify your data.
6. Set permissions for scripts:
chmod 755 /etc/network/if-up.d/00_mount_notebook_upload
chmod 755 /etc/network/if-down.d/00_umount_notebook_upload
* This source code was highlighted with Source Code Highlighter.
7. Reconnect the network connection and check for files in the mounted folder.