[foxlink] Simple way to link a HD to a HDR.

I was wondering why the WebIf's Auto processing wasn't working quite right and found there was no entry in the ...crontabs/root file, but I did find two lines which said "/mod/sbin/foxlink".
So I looked at foxlink's postinst file and found this:
Code:
grep -v webif/lib/bin/auto $cronf > $tmpf
(
  cat $tmpf
  echo '* * * * * /mod/sbin/foxlink'
) > $cronf
which rather explains it. Copy and (partial) edit strikes again!
Force reinstalling the Webif restored Auto processing.
 
Yep, until af123 gets round to fixing the package. Updates in WebIf resurrect it, which is probably why it's gone undetected for so long.
 
Last edited:
Foxlink never seems to unmount properly when the other end has gone away.
I tweaked it as follows:
Code:
humax /mnt/hd2/mod/sbin # diff foxlink~ foxlink
--- foxlink~
+++ foxlink
@@ -31,7 +31,7 @@
        [ $debug -eq 1 ] && echo Ping fail.
        if mount | grep "/media/$dir"; then
                [ $debug -eq 1 ] && echo Unmounting.
-               umount -f "/media/$dir"
+               umount -l "/media/$dir"
        fi
 fi
and it's solved all the problems.
"umount -f" always complained about being unable to unmount, because something was in use.

I commend this solution to the repository.
 
I was wondering why the WebIf's Auto processing wasn't working quite right and found there was no entry in the ...crontabs/root file, but I did find two lines which said "/mod/sbin/foxlink".
So I looked at foxlink's postinst file and found this:
Code:
grep -v webif/lib/bin/auto $cronf > $tmpf
(
  cat $tmpf
  echo '* * * * * /mod/sbin/foxlink'
) > $cronf
which rather explains it. Copy and (partial) edit strikes again!
Force reinstalling the Webif restored Auto processing.
Now that's odd - it's fine in the copy on my packaging machine!

Code:
------------------------------------------------------------------------
r3198 | af | 2016-08-22 23:35:38 +0100 (Mon, 22 Aug 2016) | 1 line

fix removal of auto job
 
Now that's odd - it's fine in the copy on my packaging machine!
That was almost exactly a year ago. Perhaps you fixed it after my message at that time? I don't know now what was released (if anything).
 
Patch to allow numbers in local directory name:
Diff:
humax /mnt/hd2/mod/webif/plugin/foxlink # diff update.jim~ update.jim
--- update.jim~
+++ update.jim
@@ -19,7 +19,7 @@
        exit
 }
 
-if {![regexp -nocase {^[- a-z_]+$} $dir]} {
+if {![regexp -nocase {^[- a-z0-9_]+$} $dir]} {
        puts "Invalid local directory name."
        exit
 }
 
Is it possible to use foxlink with two HDs (both with USB HD)? I have installed foxlink and virtual-disk2 on both, but am not seeing files on the other box, just an empty VirtualUSB folder.
 
From the initial post in this thread
...
Foxlink doesn't do anything that the existing network-shares-automount can't do but is much simpler to configure and doesn't create the file-based configuration tree that some people find distracting. If you need any more functionality that a simple one-way link from a HD to a HDR then you should use network-shares-automount.
...
So the package isn't going to be enhanced to your requirement.

Nonetheless if you're brave/skilled enough, and are prepared to use a text editor instead of Webif>Settings to configure Foxlink, you can try modifying the /mod/sbin/foxlink script like this (look for the two *** comments).
Code:
#!/bin/sh

cfg=/mod/etc/foxlink.conf
[ -f $cfg ] || exit 0

if [ "$1" = "-d" ]; then
        debug=1
        shift
else
        debug=0
fi

getcfg()
{
        grep "^$1=" $cfg | cut -d= -f2
}

peer="`getcfg peer`"
[ -n "$peer" ] || exit 0

dir="`getcfg dir`"
# *** add this line
p_dir="`getcfg p_dir`"; p_dir="${p_dir:-/mnt/hd2/My Video}"
if ping -q -c3 -w3 $peer; then
        [ $debug -eq 1 ] && echo Ping success.
        [ -n "$dir" ] || exit 0
        if ! mount | grep "/media/$dir"; then
                [ $debug -eq 1 ] && echo Mounting.
                mkdir "/media/$dir"
                # *** change this line as below
                # mount "$peer:/mnt/hd2/My Video" "/media/$dir"
                mount "${peer}:${p_dir}" "/media/$dir"
        fi
else
        [ $debug -eq 1 ] && echo Ping fail.
        if mount | grep "/media/$dir"; then
                [ $debug -eq 1 ] && echo Unmounting.
                umount -l "/media/$dir"
        fi
fi
Then you should add a line like p_dir=/media/drive1/Video (where the path is the Video folder on the remote HD) to the local /mod/etc/foxlink.conf and possibly change the dir= line to match the remote machine. Don't use the Webif settings as that would wipe out the additional line. And then:
Code:
hdr# cat /etc/model
HDR
hdr# /mod/sbin/foxlink
PING 192.168.x.y(192.168.x.y): 56 data bytes

--- 192.168.x.y ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.936/2.729/4.000 ms
192.168.x.y:/media/drive1/Video on /media/HD type nfs (rw,vers=3,rsize=32768,wsize=32768,hard,proto=tcp,timeo=70,retrans=3,sec=sys,addr=192.168.x.y)
hdr# ls /media/HD
A Christmas Carol Goes Wrong_20180101_1315.hmt
A Christmas Carol Goes Wrong_20180101_1315.nts
A Christmas Carol Goes Wrong_20180101_1315.thm
A Christmas Carol Goes Wrong_20180101_1315.ts
...
 
Here are couple of further improvements to the original /mod/sbin/foxlink:
Code:
--- foxlink        2020-02-21 14:11:49.000000000 +0000
+++ foxlink.new    2020-02-21 14:10:48.000000000 +0000
@@ -19,7 +19,7 @@
 [ -n "$peer" ] || exit 0
 
 dir="`getcfg dir`"
-if ping -q -c3 -w3 $peer; then 
+if ping_res="$(ping -q -c3 -w3 $peer)"; then 
        [ $debug -eq 1 ] && echo Ping success.
        [ -n "$dir" ] || exit 0
        if ! mount | grep "/media/$dir"; then
@@ -28,8 +28,8 @@
                 mount "${peer}:/mnt/hd2/My Video" "/media/$dir"
        fi
 else
-       [ $debug -eq 1 ] && echo Ping fail.
-       if mount | grep "/media/$dir"; then
+       [ $debug -eq 1 ] && { echo Ping fail:; echo "$ping_res"; }
+       if mount | grep -q "/media/$dir"; then
                [ $debug -eq 1 ] && echo Unmounting.
                umount -l "/media/$dir"
        fi
 
Is it possible to use foxlink with two HDs (both with USB HD)? I have installed foxlink and virtual-disk2 on both, but am not seeing files on the other box, just an empty VirtualUSB folder.
Why not just use network-shares-automount?
 
Thank you for the replies. I am trying to use network-shares-automount but with not much success. I have been able to access a shared folder on my PC with it; but I cannot see the Video folder on the other Humax HD T2. I have used "folder =Video" and host=192.168.1.21 (the IP address of the other box) but unlike with my pc share the folder is not created. Scanmounts log shows
"mount -t cifs //192.168.1.21/Video /media/humax1 -o user=User,password=Password,domain=Domain or Workgroup,unc=\\192.168.1.21\Video"
"mount: mounting //192.168.1.21/Video on /media/humax1 failed: No such device or address "
Is there anything else I need to do? Does installing samba automatically share the Video folder?
 
Does installing samba automatically share the Video folder?
Well now, that's an interesting point because I have just realised you are talking about sharing between two HD-FOXes not two HDR-FOXes (I do wish people would be rigorous about terminology). It is possible the /mod/etc/smb.conf file does not have the correct path in it for the HD-FOX file system (as opposed to the HDR-FOX file system).

For sharing from a HDR-FOX, all I do is install samba and then connect to it with a network-shares-automount SMB configuration (as illustrated in the NSA thread). All my units are interlinked... except my HD-FOX is only configured as a sink (not a source). It is straightforward to edit the smb.conf: WebIF >> Diagnostics >> File Editor, Open File /mod/etc/smb.conf.

However: how do you plan to overcome the encryption? There is no native decryption on the HD-FOX (except by jumping through significant hoops), which is why foxlink (et al) is primarily intended for viewing HDR-FOX auto-decrypted content on another HDR-FOX or HD-FOX.

There is a way around that now: the CF can impose a different user-specified key so that recordings made on two machines are encrypted with the same key and can therefore be decrypted by either machine on playback. However, recordings made previously will have to be software-decrypted (or HDR-Mode decrypted) first otherwise they will become unplayable.

Decryption Guide (click)
 
Last edited:
domain=Domain or Workgroup
I would change that to make sure it hasn't got any spaces in it. Funny things start happening if you have.
Is there anything else I need to do?
From a command prompt, you could try smbclient -NL 192.168.1.21 and it should show you what's being shared.
 
Thank you for the replies. I edited the smb.conf file as suggested, changed the line referencing Fox-HDR-T2 to Fox-HD-T2. Still the same error,


mount: mounting //192.168.1.21/Video on /media/humax1 failed: No such device or address
Next I changed domain to WORKGROUP, also no change.
I have tried using video and VIDEO as well.
Here is a screenshot of running smbclient.smbclient2.jpg
If I can get this working I will decrypt manually.
 
For HD/R <-> HD/R shares, NFS is probably a better bet than SMB. As you have installed foxlink, the NFS setup should be ready to go using network-shares-automount.
 
But again, not necessarily correctly configured for HD-FOX as a server. I'll have a play tonight.
 
Apparently everything is there. It's up to network-shares-automount to configure a particular share.
Code:
# opkg depends foxlink
foxlink depends on:
        webif (>= 0.11.0)
        nfs-utils
# opkg files nfs-utils
Package nfs-utils (1.2.3-2) is installed on root and has the following files:
/mod/sbin/rpc.statd
/mod/sbin/sm-notify
/mod/etc/init.d/S98nfs-server
/mod/sbin/rpc.mountd
/mod/sbin/showmount
/mod/sbin/nfsiostat
/mod/sbin/mountstats
/mod/sbin/nfsstat
/mod/sbin/exportfs
/mod/sbin/rpcdebug
/mod/sbin/rpc.nfsd
/mod/etc/exports
/mod/lib/modules/exportfs.ko
/mod/lib/modules/nfsd.ko
/mod/etc/nfs.conf
/mod/sbin/start-statd
#
 
Back
Top