auto unmount .dmg if it has not been accessed for a while

The OS doens't allow that out of the box (neither for dmg nor real partitions).

What I would do is create a script that would listen to that mounted image and after x time idle, unmount it.

Applescript is a fairly simple way to get that working (or via an automator flow).

Some pointers:

(the tricky part is getting the disk image idle)

http://www.mactech.com/articles/mactech/Vol.20/20.07/FolderWatching/index.html

http://webcache.googleusercontent.com/search?q=cache:IjvM1V_MxroJ:macscripter.net/viewtopic.php%3Fid%3D39468+&cd=4&hl=en&ct=clnk&client=safari

Checking for folder/file changes using Automator?

How to run Applescript on Disk mount

Automatically launch a program or action when an external drive or disk is connected

I'll make an example later today, but the flow will be like this:

open script

drag mounted image disk to it

monitor this disk access (every x time, to save processor)

if last time accessed > idlelimit then     
    eject disk
    quit script

otherwise

keep checking