docs: def get_pkg_id(pkg):
      '''
      Attempt to get the package ID from a .pkg file
  
      Args:
          pkg (str): The location of the pkg file
  
      Returns:
          list: List of all of the package IDs
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' macpackage.get_pkg_id /tmp/test.pkg
      '''
      pkg = _quote(pkg)
      package_ids = []
  
      # Create temp directory
      temp_dir = __salt__['temp.dir'](prefix='pkg-')
  
      try:
          # List all of the PackageInfo files
          cmd = 'xar -t -f {0} | grep PackageInfo'.format(pkg)
          out = __salt__['cmd.run'](cmd, python_shell=True, output_loglevel='quiet')
          files = out.split('\n')
  
          if 'Error opening' not in out:
              # Extract the PackageInfo files
              cmd = 'xar -x -f {0} {1}'.format(pkg, ' '.join(files))
              __salt__['cmd.run'](cmd, cwd=temp_dir, output_loglevel='quiet')
  
              # Find our identifiers
              for f in files:
                  i = _get_pkg_id_from_pkginfo(os.path.join(temp_dir, f))
                  if i:
                      package_ids.extend(i)
          else:
              package_ids = _get_pkg_id_dir(pkg)
  
      finally:
          # Clean up
          __salt__['file.remove'](temp_dir)
  
      return package_ids