def attach_dmg
      @device ||= Dir.chdir(staging_dir) do
        log.info(log_key) { "Attaching dmg as disk" }

        cmd = shellout! <<-EOH.gsub(/^ {10}/, "")
          hdiutil attach \\
            -readwrite \\
            -noverify \\
            -noautoopen \\
            "#{writable_dmg}" | egrep '^/dev/' | sed 1q | awk '{print $1}'
        EOH

        cmd.stdout.strip
      end
    end
def attach_dmg
      @device ||= Dir.chdir(staging_dir) do
        log.info(log_key) { "Attaching dmg as disk" }

        cmd = shellout! <<-EOH.gsub(/^ {10}/, "")
          hdiutil attach \\
            -readwrite \\
            -noverify \\
            -noautoopen \\
            "#{writable_dmg}" | egrep '^/dev/' | sed 1q | awk '{print $1}'
        EOH

        cmd.stdout.strip
      end
    end
Attach the dmg, storing a reference to the device for later use.

 @return [String]
   the name of the attached device