Mount everything, Homebrew with sshfs.

This first Homebrew is a Proof of concept for mounting any filesytem network,
even through the internet.

It is not possible to add functionalities to the proprietary WDTV software interface.
The sources of this software are not distributed by Western. Nevertheless, the whole environment around the interface software is open source. We will therefore modify the scripts called by the OSD. When you select the “Local Server” and “NFS” functions,
the OSD uses the /bin/find_nfs_server.sh, then /bin/find_nfs_share_folder.sh scripts.
Modifying these scripts to return other information than the NFS servers, will allow us
to add new servers and protocols / filesystems to the OSD interface. Once all the parameters are recovered by the OSD, everything is sent to the mount command.

Now let me introduce Busybox. Busybox is a toolkit containing many Linux programs. This is a quick and effective way to get a working system. Busybox can be used in two ways: By calling the command wanted behind Busybox, or by creating a symbolic link.
The mount command is a symbolic link to the BusyBox binary.
By replacing the symbolic link mount by a script, it is possible to intercept the parameters passed by the OSD to the mount command, manipulate or override these settings, and finally call the busybox mount command with the modified settings.

This Homebrew integrates all the binaries needed to run sshfs. You don’t need to recompile all the binaries and libraries. The processor architecture is the same as the other WDTV versions, so you can re-use all binaries that do not use a specific hardware.

The /bin/find_nfs_server.sh and /bin/find_nfs_share_folder.sh scripts have been modified to read the file /conf/server and add the resulting contents to the OSD.

The symbolic link mount has been replaced to run sshfs if the server name is given in the /conf/server file. If this is not the case, the busybox mount command is called seamlessly.
Authentification is based on a rsa_id key and must be placed in /conf.
The /etc/ssh/ssh_config file automatically adds new servers in the /conf/known_hosts without prompting.

Files added to the Homebrew from the compilation 1.05.14_G base are available here. There is no need to recompile all sources : just add files in the PALACE_1.05.14_G/build/root folder then the execute the make firmware command to rebuild the firmware.

The complete firmware including sshfs and phpShell is available here.

If something goes wrong, the /tmp/mount file includes the sshfs command executed by the mount script. You can try to execute the command manually.

Warning: Changing the mount command is very dangerous. If it does not work,
your WDTV will be bricked.
Test your mount script by creating a clone of the /bin folder on a USB key. Then mount this file instead of the original /bin folder using
the mount -o bind /media/USB/nameofyourkey/bin /bin command.

By using these scripts as an operating model, you can adapt them to mount any local or network file system on any IP, yet controlled by the OSD interface.

Thanks go to Elrick for the mount script tip.