info.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const fs = require('fs')
  2. const path = require('path')
  3. const log = require('../../util/log')
  4. const plist = require('../../util/plist')
  5. module.exports = {
  6. version: 4,
  7. name: 'backup.info',
  8. description: `Gets a backup's info`,
  9. requiresBackup: true,
  10. // Run on a v3 lib / backup object.
  11. async run (lib, { backup }) {
  12. // Get the path for the info plist.
  13. let infoPath = path.join(backup.path, 'Info.plist')
  14. log.verbose('parsing info', infoPath)
  15. var data = plist.parseFile(infoPath)
  16. // Remove this data, it's kind of useless.
  17. delete data['iTunes Files']
  18. return data
  19. },
  20. // Public facing properties
  21. output: {
  22. buildVersion: el => el['Build Version'],
  23. deviceName: el => el['Device Name'],
  24. displayName: el => el['Display Name'],
  25. guid: el => el['GUID'],
  26. installedApplications: el => el['Installed Applications'],
  27. lastBackupDate: el => el['Last Backup Date'],
  28. productName: el => el['Product Name'],
  29. productType: el => el['Product Type'],
  30. productVersion: el => el['Product Version'],
  31. serialNumber: el => el['Serial Number'],
  32. targetIdentifier: el => el['Target Identifier'],
  33. targetType: el => el['Target Type'],
  34. uniqueIdentifier: el => el['Unique Identifier'],
  35. iTunesSettings: el => el['iTunes Settings'],
  36. iTunesVersion: el => el['iTunes Version']
  37. }
  38. }