OUYA NFS Mount Script

Mount a remote location to the OUYA file system.

0 Comments

For any of the retro and emu gamers out there, here is a script that you can use with Universal Init.d to mount an NFS share to the OUYA on boot. This OUYA NFS mount script means no more needing to launch a particular script or application to mount the share when ever you want to get your ROM on. Unlike other scripts out there, this one will actually keep trying to mount the share for up to 15 minutes before it gives up. This is great for the those times that you have a slow to establish connection or if you need to set up your wi-fi connection first.

Prerequisites

In order to get this working you will need both Busybox and Init.d installed on your OUYA, your OUYA will also need to be rooted.

Rooting

There are a number of ways to achieve this, but I recommend ReRoot

Universial Init.d

Init.d setup This application is needed to start the script at boot time. Install the application on your OUYA device and then make sure you turn it on in the application itself.

Remember, any scripts you want Universal Init.d to launch must be in the /etc/init.d folder.

Busybox

Busybox Installer This handy toolbox of commands is not only needed to run this script, but many of the scripts you find on the internet make sure you install it before you try to run the script.

The Script

#!/bin/sh

LOGGER="/mnt/sdcard/nfsmount.log"
LOOPCOUNT=0
SERVERIP="192.168.0.101"
echo "" > $LOGGER

if [ ! -d /mnt/sdcard/emu ]; then
    echo "Creating emu folder" >> $LOGGER
    mkdir -p /mnt/sdcard/emu
fi

while [ $LOOPCOUNT -lt 90 ]; do
    echo "Polling for Remote Device!" >> $LOGGER
    echo "Loop Count: ${LOOPCOUNT}" >> $LOGGER

    # Exit the loop if network is found
    PINGTEST=$(ping -c 1 $SERVERIP)
    echo "PINGTEST: ${PINGTEST}" >> $LOGGER
    PINGTEST=$(echo ${PINGTEST} | grep '+1 errors')

    if [ "$PINGTEST" == "" ]; then
        echo "Remote Device found!" >> $LOGGER
        sleep 10
        /system/xbin/busybox mount -o nolock,rw,hard,intr,vers=3 -t nfs "${SERVERIP}:/c/emu" "/mnt/sdcard/emu" >> $LOGGER
        exit;
    fi

    LOOPCOUNT=$((LOOPCOUNT + 1))
sleep 10;
done

# If there is still no response then bail
echo "Remote Device still not found, giving up" >> $LOGGER
exit

*Make sure you set the SERVERIP variable to the IP of the NFS Server the share is on.

Download nfsmount

- By: Last Updated:

Comments

Small ad here
Select a size at which to preview the size