       tmpDir = if process.env.TMPDIR? then process.env.TMPDIR else '/tmp'
       if installDir.indexOf(tmpDir) isnt 0
         desktopFile = path.join('resources', 'linux', 'atom.desktop.in')
-        desktopInstallFile = path.join(installDir, 'share', 'applications', appDirName + '.desktop')
+        desktopInstallFile = path.join(installDir, 'share', 'applications', appFileName + '.desktop')
 
         {description} = grunt.file.readJSON('package.json')
         iconName = path.join(shareDir, 'resources', 'app.asar.unpacked', 'resources', 'atom.png')

      # Create relative symbol link for apm.
      process.chdir(binDir)
      rm('apm')
      fs.symlinkSync(path.join('..', 'share', appDirName, 'resources', 'app', 'apm', 'node_modules', '.bin', 'apm'), 'apm')

      fs.chmodSync(path.join(shareDir, 'atom'), "755")

      fs.renameSync(tempFolder, installDir)
    else
      binDir = path.join(installDir, 'bin')
      appFileName = appName.toLowerCase().replace(/\s+/g, '-')
      shareDir = path.join(installDir, 'share', appFileName)

      mkdir binDir
      cp 'atom.sh', path.join(binDir, appFileName)
      rm shareDir
      mkdir path.dirname(shareDir)
      cp shellAppDir, shareDir
