 
   # Delete the archive.
   unarchive: ->
-    @debug "unarchive"
+    @debug 'unarchive'
     @archived().then (archived) =>
       throw new Error "not archived" unless archived
       Q.nfcall fs.unlink, path.join @constructor.home, @archive()
 
   # Delete the ova.
   unova: ->
-    @debug "unova"
+    @debug 'unova'
     @ovaed().then (ovaed) =>
       throw new Error "not ovaed" unless ovaed
       Q.nfcall fs.unlink, path.join @constructor.home, @ova()

    deferred.promise.timeout timeout

  _waitForGuestControl: (deferred, delay=1000) ->
    @debug "waitForGuestControl"
    return null if deferred.promise.isRejected()
    @info().then (info) =>
      runlevel = info.GuestAdditionsRunLevel
      @debug "waitForGuestControl: runlevel #{runlevel}"
      return deferred.resolve true if runlevel? and parseInt(runlevel) > 2
      Q.delay(delay).then => @_waitForGuestControl deferred, delay


  @home: path.join process.env.HOME, '.ievms'

  # The command used to install virtual machines via ievms.
  @ievmsCmd: 'curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | bash'
  # @ievmsCmd: 'cd ~/Code/ievms && cat ievms.sh | bash'

  # ## Class Methods

  # Run ievms shell script with a given environment. A debug function may be 
  # passed (like `console.log`) which will be called for each line of ievms
  # output.
  @ievms: (env, dbg=debug) ->
    deferred = Q.defer()
    cmd = ['bash', '-c', @ievmsCmd]
    dbg "ievms: #{cmd.join ' '}"
    ievms = child_process.spawn cmd.shift(), cmd, env: env
    ievms.on 'error', (err) -> deferred.reject err
    ievms.on 'exit', -> deferred.resolve true
    ievms.stdout.on 'readable', ->
      out = ievms.stdout.read()
      dbg "ievms: #{l}" for l in out.toString().trim().split "\n" if out?
    deferred.promise

  # Build a list with an IEVM instance of each available type.
  @all: -> new @ n for n in @names
