Note: This guide applies to OSD firmware versions 3.33-1.** and lower (aka Torfu). The 3.33-2.** firmware (aka Arizona) incorporates functionality that replaces this hack.
-GHowto: Mount your network shares on bootupHey all,
I've managed to figure out how to get the OSD to load network shares on bootup, so you'll never have to type a username & password using the remote again! I'm no hacker, so this is very rough, but it works nicely for me. Here's a brief jist of how it's done:
It appears the directory /mnt/OSD is permanent storage, a power cycle does not erase its contents. Also, the /etc/init.d/rc bootup script actually looks for a shell script named rc.user in this directory & runs it if it exists - so all you've to do is figure out the mount commands for your shares, put them in this file & off you go!
Naturally, you'll need to be telnetted into the OSD for this. As a reminder, the username is "root" with either no password asked (for older fw), or else try "pablod".
Samba/Windows sharesThe mount command looks like:
mount.cifs //<SERVER_ADDY>/<SHARE_FOLDER> /media/<MOUNT_POINT> -o user=USERNAME,pass=PASSWORD,rw,nolock
where:
SERVER_ADDY is the IP address or hostname of the server.
SHARE_FOLDER is the name of the folder that's being shared.
MOUNT_POINT is an empty folder you wish for the share to appear (don't forget to create this first!)
USERNAME & PASSWORD are the details you use to connect to this share
So for example
1:
mount.cifs //192.168.1.2/Video /media/Video -o user=joe,pass=bloggs,rw,nolock
NFS sharesThose with linux NFS shares setup can easily mount them using:
mount -t nfs <SERVER_ADDY>:<ABS_PATH_TO_SHARE> /media/<MOUNT_POINT> -o rw,nolock,tcp,nfsvers=3
where:
SERVER_ADDY is the IP address or hostname of the server.
ABS_PATH_TO_SHARE is the absolute path of the folder that's being shared, matching that in /etc/exports on your server.
MOUNT_POINT is where the share appears.
Eg:
mount -t nfs 192.168.1.2:/home/Tunes /media/Tunes -o rw,nolock,tcp,nfsvers=3
Writing the bootup scriptOnce you've figured out the mount command(s), we just need to get them running automatically. Now initially I simply tried to stick them into /mnt/OSD/rc.user, but these mount commands didn't work correctly. While "mount" showed the resources correctly, trying to access them resulted in a server timeout each and every time. I guess that while rc.user is being run, other init process haven't completed which interfere with mount. So I tried to insert a "sleep 20" command before the mounts, which also didn't help confusingly. Eventually I did the following:
In /etc/OSD/rc.user (create if necessary), put the lines:
#!/bin/sh
sh bootscript.sh &
Then create a file in /etc/OSD called bootscript.sh, where you first issue a "sleep 20" command to wait for init process to finish, then run your mount commands. Also don't forget to make the mount point(s) first, as they vanish on reboot. You can use vi to edit text files on the OSD. Here's a crude example of bootscript.sh:
#!/bin/sh
sleep 20;
mkdir /media/Videos;
mkdir /media/Tunes;
mount.cifs //192.168.1.2/Video /media/Video -o user=joe,pass=bloggs,rw,nolock;
mount -t nfs 192.168.1.2:/home/Tunes /media/Tunes -o nolock,tcp,soft,intr,nfsvers=3;
Now for safety sake, test your bootscript.sh by running "sh ./bootscript.sh" to ensure the script runs correctly & has no syntax errors. If it works correctly, just reboot your OSD and you should see your network shares
2 right there under Play|Browse! Now this is no means perfect, so please play around and if you've suggestions please let me know.
Enjoy!
-G
Note 1: entering this command sometimes gives a "could not update mount table" error, however the mount works! I'm guessing it's trying to update mtab which is read-only. No harm comes from this.Note 2: if for some reason your mount commands fail, your mount point will still exist as simpe folders, and trying to record to them will quickly go wrong! A more elegant script would stick each mount in an if-else statement & clean up such errors. I've just kept it simple, such things are an exercise for the reader
EDIT (26/10/07): Extended sleep interval to 20 seconds as OSD initialisation is taking longer. Also recommended testing the bootscript manually before saving & rebooting, as corrupt bootscript.sh has been reported to interfere with bootup.