Automated NFS-Server for Automount Shares

Hi,

Me & @bmillham have been working on a python3 script to automate the setup of an nfs server on osmc, for automounted usb shares. It also assists with non-automounted shares as well. The script can be found here:

I would appreciate if some of you guys could find some time to test, all feedback is welcome. I would suggest running the script as I dry-run to start with, just to get an overview of what it does:

sudo python3 nfs-server-setup.py --dry-run

If the output looks OK after using the --dry-run option, run the script again to actually make the changes:

sudo python3 nfs-server-setup.py

All changes can be reverted by running the uninstall script.:

sudo python3 uninstall-nfs-server.py

Thinks Tom.

1 Like

Does this offer identical export behaviour to SMB Server?
Have you seen how we have done this with SMB and UDisks?

If we can match the functionality, we could add it to the App Store.

neat work @Tom_Doyle need to test this out :slight_smile: you should include it on the pip store, if you check the kodi api you can make dialogs in kodi for this

Hi @sam_nazarko,

Currently the script just exports /media, so as a result any auto mounted usb drive under this directory can be mounted client side (or just /media). I’ll look in to replicating it to work with UDisks.

edit:

@sam_nazarko please when you get a minute could you point me to Udisks for SMB, I’ve had a look here:

It just seems to be mounting /media, which is the same as my script.

Hi @Toast,

Being currently its osmc specific, so it may not be a good candidate for the pip store; maybe it will be if/when I can get it to work with UDisks. As for kodi api/dialogs I’ll look in to this when the remaining functionality is added to the script.

Once you’ve tested it out, any ideas or issues; please let me know.

Thanks Tom.

loads of stuff that are pretty specific on pip that doesnt mean they have no place there

ok cool

1 Like

Exporting /media is just fine. I’ll need to work out how we would expose some of the settings you added to the script.

1 Like

Hi Sam,

Been looking at exposing the some of the settings as dialog with in kodi, the best way appears to be the xbmcgui module. To use this module with kodi 18, I would need to rewrite the script in python2; which is an option but it may just be better to wait for kodi 19 before adding to the app store.

I’m going to have go getting this to work with a nightly build. I’ll let you know how I get on.

Thanks Tom.

1 Like

Focus on Python3 since Python 2 is basically going the way of the dodo bird

1 Like

Hi,

I’ve now created a script that works within kodi, for both kodi 18 & 19; I’ve also created created an uninstall script. Again I would appreciate it if a few of you could test this please.

Install: osmc-nfs-server-python3/Kodi-nfs-server-setup.py at master · tomdoyle87/osmc-nfs-server-python3 · GitHub

Uninstall: osmc-nfs-server-python3/Kodi-uninstall-nfs-server.py at master · tomdoyle87/osmc-nfs-server-python3 · GitHub

The easiest way is to map some shortcuts to some keys for example f11 & f12, for example (will need to use the command line):

cd /home/osmc/.kodi/userdata
wget https://raw.githubusercontent.com/tomdoyle87/osmc-nfs-server-python3/master/Kodi-nfs-server-setup.py
wget https://raw.githubusercontent.com/tomdoyle87/osmc-nfs-server-python3/master/Kodi-uninstall-nfs-server.py

Then add the following to keyboard.xml or remote.xml (in the global section):

<keyboard>                                                                  
      <F11>XBMC.RunScript(special://home/Kodi-nfs-server-setup.py)</F11>                      
      <F12>XBMC.RunScript(special://home/Kodi-uninstall-nfs-server.py)</F12>    
</keyboard>

If you need any further assistance setting up, please let me know. Also I will gladly receive any thoughts or feedback.

Thanks Tom.

2 Likes

Worked just fine for me on both kodi 18 and 19

1 Like

Hi Toast,

I’ve just realised the scripts were still set to dry-run, so it was only going through the menu prompts and not actually installing anything.

Any chance you could please test again? The script will now install and configure the NFS server.

Thanks Tom.

haha ok well it was a good dry run atleast just tried it before work ill will review as soon as possible when i get out of work

1 Like

Hi Toast,

just wonder if you have had chance to test the script again?

Thanks Tom.

Sorry Tom havent gotten around to it will be home this week a bit under the weather, so ill probly get around to it :slight_smile:

Ok no worries, hope you feel better soon.

Hi @Tom_Doyle
i tried and everything works flawlessy. Just one thing tomention. U have not NO_SUBTREE_CHECK flag added to shares. I think this flag is default today.

I´ve got just problem where nfs server or client badly encode filenames with nonstandard chars like ě etc. NFS client in windows shows me instead of the ě just ?? or similar chars. Cant solve that.