Automatically start kodi at boot

I’d like to autostart kodi at boot, but when I do this it seems to be coming up slightly differently to if I ssh onto the Pi and start it. For example, the USB keys are mounted in a different location. I’d like to have kodi work the same way whether it’s automatically loaded at startup, or via ssh.

I’ve tried both using a cron task with @reboot and adding a line to /etc/rc.local. When using the latter method i’m using:

sudo su pi -c ‘nohup /home/pi/kodistarter.sh &’

and this works fine from ssh but not upon boot. The sudo su pi business didn’t make any difference.

I’m using a full up to date raspbian and have no interest in using another distro.