Lakka Network Samba Roms Directory

Here is my technique for having the Lakka roms directory mounted on the network.
This allows for all yours roms to be on the network and every Lakka instance can access them.

Let's get started.

First boot into Lakka.
Make sure 'SSH Enable' is set to ON in Settings -> Lakka Services.

Now we need to SSH into Lakka.
We do this using a program called Putty on a Windows computer that is on the same network as the Pi.

Download putty.exe from here

Save it somewhere you can easily find it.
It's portable - which means it doesn't need to be installed.
Open the downloaded putty.exe to start Putty.

Enter the IP address of Lakka in the host name field and make sure the port is 22.
(Find the IP in Lakka ->  Information -> Network Information -> Interface eth0)
Then click Open.

You should see "login as:" appear.
Type root and hit enter. Now type in the password root and hit enter.

You should now be logged into Lakka remotely.
Now, you can copy the below commands into the terminal window.

First, we need to create a directory in the roms folder for our mount.
We could mount over our entire roms directory but having a separate directory for our network roms allows us to have both local roms and also network roms.

Run the below command to create this directory.
mkdir -p /storage/roms/samba
Now let's create an script which runs at boot and mounts our share.
nano /storage/.config/
Copy the below text into the editor
#!/bin/sh ( while ! ping -c 1 -W 1 {IP}; do sleep 0.5 done mount -t cifs -o user={USER},password={PASS},rw //{IP}/{SHARE} /storage/roms/samba ) &
If the file is already populated then simply copy all the lines below #!/bin/sh to the bottom of the file.

If your share doesn't require username / password, then use the below mount line instead.
mount -t cifs -o user=guest,rw //{IP}/{SHARE} /storage/roms/samba
Replace {IP} with the IP address of your share & replace {SHARE} with the name of the share.
If required, replace {USER} and {PASS} to what is required for your share.
Note: It appears Lakka requires write (rw) permission to the network share.

If your using my dual boot image, then the file should look like this:

Save the file (CTRL-X, Y, ENTER)

Now we need to create a script to un-mount our share.
nano /storage/.config/
Copy the below text into the editor
umount /storage/roms/samba

Again, if the file is already populated simply copy the "umount" line to the bottom of the file.

Save the file (CTRL-X, Y, ENTER)

Now make the two scripts executable
chmod +x /storage/.config/ chmod +x /storage/.config/
And that's it :)

Reboot Lakka.

Lakka will start and as long as your samba share is available, it will be mounted.
Now you can proceed to scan in your roms from the folder as you normally would with local roms.

If for some reason Lakka can't mount the share, it will still start up as normal.
It will also still show the scanned in roms.
It simply will give you a "File could not be loaded from playlist" error if you try to run a rom from that share.