apps.js 899 B

1234567891011121314151617181920212223242526272829303132333435
  1. module.exports = {
  2. version: 4,
  3. name: 'system.apps',
  4. description: `List all installed applications and container IDs.`,
  5. requiresBackup: true,
  6. // Run on a v3 lib / backup object.
  7. run (lib, { backup }) {
  8. return new Promise(async (resolve, reject) => {
  9. try {
  10. // This report directly depends on manifest report.
  11. // If it fails, so do we.
  12. let manifest = await lib.run('backup.manifest', { backup, raw: true })
  13. // Fetch each app in the manifest.
  14. var apps = []
  15. for (var key in manifest.Applications) {
  16. var app = manifest.Applications[key]
  17. apps.push({ bundleID: app.CFBundleIdentifier, path: app.Path })
  18. }
  19. resolve(apps)
  20. } catch (e) {
  21. reject(e)
  22. }
  23. })
  24. },
  25. // Fields for apps report
  26. output: {
  27. bundleID: el => el.bundleID || null,
  28. path: el => el.path || null
  29. }
  30. }