autopkg / hjuutilainen-recipes

Recipes for AutoPkg
MIT License
49 stars 74 forks source link

Add collection of minimum os version from R.app #198

Closed apizz closed 2 years ago

apizz commented 2 years ago

Add PlistReader to collect the R.app 's LSMinimumSystemVersion key value for autopopulating munki's minimum_os_version and add this collected value to existing MunkiPkginfoMerger.

Test run successful output:

arun Rtest.munki 
Processing Rtest.munki...
WARNING: Rtest.munki is missing trust info and FAIL_RECIPES_WITHOUT_TRUST_INFO is not set. Proceeding...
URLTextSearcher
{'Input': {'re_pattern': '(?P<r_filename>base\\/R-(?P<r_version>[0-9\\.]+)\\.pkg)',
           'url': 'https://cloud.r-project.org/bin/macosx/'}}
URLTextSearcher: No value supplied for result_output_var_name, setting default value of: match
URLTextSearcher: Found matching text (r_filename): base/R-4.1.0.pkg
URLTextSearcher: Found matching text (r_version): 4.1.0
URLTextSearcher: Found matching text (match): base/R-4.1.0.pkg
{'Output': {'match': 'base/R-4.1.0.pkg',
            'r_filename': 'base/R-4.1.0.pkg',
            'r_version': '4.1.0'}}
URLDownloader
{'Input': {'filename': 'R.pkg',
           'url': 'https://cloud.r-project.org/bin/macosx/base/R-4.1.0.pkg'}}
URLDownloader: No value supplied for prefetch_filename, setting default value of: False
URLDownloader: No value supplied for CHECK_FILESIZE_ONLY, setting default value of: False
URLDownloader: Storing new Last-Modified header: Thu, 20 May 2021 05:38:50 GMT
URLDownloader: Storing new ETag header: "563f326-5c2bc5b9f48a9"
URLDownloader: Downloaded /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg
{'Output': {'download_changed': True,
            'etag': '"563f326-5c2bc5b9f48a9"',
            'last_modified': 'Thu, 20 May 2021 05:38:50 GMT',
            'pathname': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg',
            'url_downloader_summary_result': {'data': {'download_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg'},
                                              'summary_text': 'The following '
                                                              'new items were '
                                                              'downloaded:'}}}
EndOfCheckPhase
{'Input': {}}
{'Output': {}}
CodeSignatureVerifier
{'Input': {'expected_authority_names': ['Developer ID Installer: Simon Urbanek '
                                        '(VZLD955F6P)',
                                        'Developer ID Certification Authority',
                                        'Apple Root CA'],
           'input_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg'}}
CodeSignatureVerifier: Verifying installer package signature...
CodeSignatureVerifier: Package "R.pkg":
CodeSignatureVerifier:    Status: signed by a developer certificate issued by Apple for distribution
CodeSignatureVerifier:    Signed with a trusted timestamp on: 2021-05-20 02:40:29 +0000
CodeSignatureVerifier:    Certificate Chain:
CodeSignatureVerifier:     1. Developer ID Installer: Simon Urbanek (VZLD955F6P)
CodeSignatureVerifier:        Expires: 2022-05-30 12:52:25 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            DC 71 49 90 95 59 7F 5B 7E 61 7F 26 24 44 AE 8B A7 96 AA 11 C2 8B 
CodeSignatureVerifier:            0E 6D EB B9 37 2A 80 78 AF A0
CodeSignatureVerifier:        ------------------------------------------------------------------------
CodeSignatureVerifier:     2. Developer ID Certification Authority
CodeSignatureVerifier:        Expires: 2027-02-01 22:12:15 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 
CodeSignatureVerifier:            F2 9C 88 CF B0 B1 BA 63 58 7F
CodeSignatureVerifier:        ------------------------------------------------------------------------
CodeSignatureVerifier:     3. Apple Root CA
CodeSignatureVerifier:        Expires: 2035-02-09 21:40:36 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C 
CodeSignatureVerifier:            68 C5 BE 91 B5 A1 10 01 F0 24
CodeSignatureVerifier: 
CodeSignatureVerifier: Signature is valid
CodeSignatureVerifier: Authority name chain is valid
{'Output': {}}
FlatPkgUnpacker
{'Input': {'destination_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack',
           'flat_pkg_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg'}}
FlatPkgUnpacker: Unpacked /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg to /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack
{'Output': {}}
PkgRootCreator
{'Input': {'pkgdirs': {},
           'pkgroot': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks'}}
PkgRootCreator: Created /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks
{'Output': {}}
PkgPayloadUnpacker
{'Input': {'destination_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks',
           'pkg_payload_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack/R-fw.pkg/Payload'}}
PkgPayloadUnpacker: Unpacked /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack/R-fw.pkg/Payload to /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks
{'Output': {}}
PkgRootCreator
{'Input': {'pkgdirs': {},
           'pkgroot': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications'}}
PkgRootCreator: Created /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications
{'Output': {}}
PkgPayloadUnpacker
{'Input': {'destination_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications',
           'pkg_payload_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack/R-app.pkg/Payload'}}
PkgPayloadUnpacker: Unpacked /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack/R-app.pkg/Payload to /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications
{'Output': {}}
MunkiInstallsItemsCreator
{'Input': {'faux_root': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root',
           'installs_item_paths': ['/Applications/R.app',
                                   '/Library/Frameworks/R.framework']}}
MunkiInstallsItemsCreator: Created installs item for /Applications/R.app
MunkiInstallsItemsCreator: Created installs item for /Library/Frameworks/R.framework
{'Output': {'additional_pkginfo': {'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                                 'CFBundleName': 'R',
                                                 'CFBundleShortVersionString': 'R '
                                                                               '4.1.0 '
                                                                               'GUI '
                                                                               '1.76 '
                                                                               'High '
                                                                               'Sierra '
                                                                               'build',
                                                 'CFBundleVersion': '7976',
                                                 'minosversion': '10.13',
                                                 'path': '/Applications/R.app',
                                                 'type': 'application',
                                                 'version_comparison_key': 'CFBundleVersion'},
                                                {'CFBundleVersion': '4.1.0',
                                                 'path': '/Library/Frameworks/R.framework',
                                                 'type': 'bundle',
                                                 'version_comparison_key': 'CFBundleVersion'}]}}}
MunkiPkginfoMerger
{'Input': {'additional_pkginfo': {'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                                'CFBundleName': 'R',
                                                'CFBundleShortVersionString': 'R '
                                                                              '4.1.0 '
                                                                              'GUI '
                                                                              '1.76 '
                                                                              'High '
                                                                              'Sierra '
                                                                              'build',
                                                'CFBundleVersion': '7976',
                                                'minosversion': '10.13',
                                                'path': '/Applications/R.app',
                                                'type': 'application',
                                                'version_comparison_key': 'CFBundleVersion'},
                                               {'CFBundleVersion': '4.1.0',
                                                'path': '/Library/Frameworks/R.framework',
                                                'type': 'bundle',
                                                'version_comparison_key': 'CFBundleVersion'}]},
           'pkginfo': {'catalogs': ['testing'],
                       'category': 'Developer',
                       'description': 'R is a language and environment for '
                                      'statistical computing and graphics '
                                      'which provides a wide variety of '
                                      'statistical and graphical techniques: '
                                      'linear and nonlinear modelling, '
                                      'statistical tests, time series '
                                      'analysis, classification, clustering, '
                                      'etc.',
                       'developer': 'R Foundation',
                       'display_name': 'R for Mac OS X',
                       'name': 'R',
                       'unattended_install': True,
                       'unattended_uninstall': True}}}
MunkiPkginfoMerger: Merged {'installs': [{'CFBundleIdentifier': 'org.R-project.R', 'CFBundleName': 'R', 'CFBundleShortVersionString': 'R 4.1.0 GUI 1.76 High Sierra build', 'CFBundleVersion': '7976', 'minosversion': '10.13', 'path': '/Applications/R.app', 'type': 'application', 'version_comparison_key': 'CFBundleVersion'}, {'CFBundleVersion': '4.1.0', 'path': '/Library/Frameworks/R.framework', 'type': 'bundle', 'version_comparison_key': 'CFBundleVersion'}]} into pkginfo
{'Output': {'pkginfo': {'catalogs': ['testing'],
                        'category': 'Developer',
                        'description': 'R is a language and environment for '
                                       'statistical computing and graphics '
                                       'which provides a wide variety of '
                                       'statistical and graphical techniques: '
                                       'linear and nonlinear modelling, '
                                       'statistical tests, time series '
                                       'analysis, classification, clustering, '
                                       'etc.',
                        'developer': 'R Foundation',
                        'display_name': 'R for Mac OS X',
                        'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                      'CFBundleName': 'R',
                                      'CFBundleShortVersionString': 'R 4.1.0 '
                                                                    'GUI 1.76 '
                                                                    'High '
                                                                    'Sierra '
                                                                    'build',
                                      'CFBundleVersion': '7976',
                                      'minosversion': '10.13',
                                      'path': '/Applications/R.app',
                                      'type': 'application',
                                      'version_comparison_key': 'CFBundleVersion'},
                                     {'CFBundleVersion': '4.1.0',
                                      'path': '/Library/Frameworks/R.framework',
                                      'type': 'bundle',
                                      'version_comparison_key': 'CFBundleVersion'}],
                        'name': 'R',
                        'unattended_install': True,
                        'unattended_uninstall': True}}}
Versioner
{'Input': {'input_plist_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks/R.framework/Versions/Current/Resources/Info.plist',
           'plist_version_key': 'CFBundleVersion'}}
Versioner: No value supplied for skip_single_root_dir, setting default value of: False
Versioner: Found version 4.1.0 in file /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Library/Frameworks/R.framework/Versions/Current/Resources/Info.plist
{'Output': {'version': '4.1.0'}}
PlistReader
{'Input': {'info_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications/R.app/Contents/Info.plist',
           'plist_keys': {'LSMinimumSystemVersion': 'min_os_version'}}}
PlistReader: Reading: /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload/root/Applications/R.app/Contents/Info.plist
PlistReader: Assigning value of '10.13' to output variable 'min_os_version'
{'Output': {'plist_reader_output_variables': {'min_os_version': '10.13'}}}
MunkiPkginfoMerger
{'Input': {'additional_pkginfo': {'minimum_os_version': '10.13',
                                  'version': '4.1.0'},
           'pkginfo': {'catalogs': ['testing'],
                       'category': 'Developer',
                       'description': 'R is a language and environment for '
                                      'statistical computing and graphics '
                                      'which provides a wide variety of '
                                      'statistical and graphical techniques: '
                                      'linear and nonlinear modelling, '
                                      'statistical tests, time series '
                                      'analysis, classification, clustering, '
                                      'etc.',
                       'developer': 'R Foundation',
                       'display_name': 'R for Mac OS X',
                       'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                     'CFBundleName': 'R',
                                     'CFBundleShortVersionString': 'R 4.1.0 '
                                                                   'GUI 1.76 '
                                                                   'High '
                                                                   'Sierra '
                                                                   'build',
                                     'CFBundleVersion': '7976',
                                     'minosversion': '10.13',
                                     'path': '/Applications/R.app',
                                     'type': 'application',
                                     'version_comparison_key': 'CFBundleVersion'},
                                    {'CFBundleVersion': '4.1.0',
                                     'path': '/Library/Frameworks/R.framework',
                                     'type': 'bundle',
                                     'version_comparison_key': 'CFBundleVersion'}],
                       'name': 'R',
                       'unattended_install': True,
                       'unattended_uninstall': True}}}
MunkiPkginfoMerger: Merged {'minimum_os_version': '10.13', 'version': '4.1.0'} into pkginfo
{'Output': {'pkginfo': {'catalogs': ['testing'],
                        'category': 'Developer',
                        'description': 'R is a language and environment for '
                                       'statistical computing and graphics '
                                       'which provides a wide variety of '
                                       'statistical and graphical techniques: '
                                       'linear and nonlinear modelling, '
                                       'statistical tests, time series '
                                       'analysis, classification, clustering, '
                                       'etc.',
                        'developer': 'R Foundation',
                        'display_name': 'R for Mac OS X',
                        'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                      'CFBundleName': 'R',
                                      'CFBundleShortVersionString': 'R 4.1.0 '
                                                                    'GUI 1.76 '
                                                                    'High '
                                                                    'Sierra '
                                                                    'build',
                                      'CFBundleVersion': '7976',
                                      'minosversion': '10.13',
                                      'path': '/Applications/R.app',
                                      'type': 'application',
                                      'version_comparison_key': 'CFBundleVersion'},
                                     {'CFBundleVersion': '4.1.0',
                                      'path': '/Library/Frameworks/R.framework',
                                      'type': 'bundle',
                                      'version_comparison_key': 'CFBundleVersion'}],
                        'minimum_os_version': '10.13',
                        'name': 'R',
                        'unattended_install': True,
                        'unattended_uninstall': True,
                        'version': '4.1.0'}}}
PathDeleter
{'Input': {'path_list': ['/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack',
                         '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload']}}
PathDeleter: Deleted /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/unpack
PathDeleter: Deleted /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/payload
{'Output': {}}
MunkiImporter
{'Input': {'MUNKI_REPO': '/Volumes/1TB/munki_repo',
           'pkg_path': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg',
           'pkginfo': {'catalogs': ['testing'],
                       'category': 'Developer',
                       'description': 'R is a language and environment for '
                                      'statistical computing and graphics '
                                      'which provides a wide variety of '
                                      'statistical and graphical techniques: '
                                      'linear and nonlinear modelling, '
                                      'statistical tests, time series '
                                      'analysis, classification, clustering, '
                                      'etc.',
                       'developer': 'R Foundation',
                       'display_name': 'R for Mac OS X',
                       'installs': [{'CFBundleIdentifier': 'org.R-project.R',
                                     'CFBundleName': 'R',
                                     'CFBundleShortVersionString': 'R 4.1.0 '
                                                                   'GUI 1.76 '
                                                                   'High '
                                                                   'Sierra '
                                                                   'build',
                                     'CFBundleVersion': '7976',
                                     'minosversion': '10.13',
                                     'path': '/Applications/R.app',
                                     'type': 'application',
                                     'version_comparison_key': 'CFBundleVersion'},
                                    {'CFBundleVersion': '4.1.0',
                                     'path': '/Library/Frameworks/R.framework',
                                     'type': 'bundle',
                                     'version_comparison_key': 'CFBundleVersion'}],
                       'minimum_os_version': '10.13',
                       'name': 'R',
                       'unattended_install': True,
                       'unattended_uninstall': True,
                       'version': '4.1.0'},
           'repo_subdirectory': 'apps/R'}}
MunkiImporter: No value supplied for MUNKI_REPO_PLUGIN, setting default value of: FileRepo
MunkiImporter: No value supplied for MUNKILIB_DIR, setting default value of: /usr/local/munki
MunkiImporter: No value supplied for force_munki_repo_lib, setting default value of: False
MunkiImporter: Using repo lib: AutoPkgLib
MunkiImporter:         plugin: FileRepo
MunkiImporter:           repo: /Volumes/1TB/munki_repo
MunkiImporter: Item R.pkg already exists in the munki repo as pkgs/apps/r/R-4.1.0.pkg.
{'Output': {'pkg_repo_path': '/Volumes/1TB/munki_repo/pkgs/apps/r/R-4.1.0.pkg'}}
io.github.hjuutilainen.VirusTotalAnalyzer/VirusTotalAnalyzer
{'Input': {'VIRUSTOTAL_ALWAYS_REPORT': False,
           'VIRUSTOTAL_AUTO_SUBMIT': True,
           'pathname': '/Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg'}}
VirusTotalAnalyzer: No value supplied for CURL_PATH, setting default value of: /usr/bin/curl
VirusTotalAnalyzer: Calculating checksum for /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg
VirusTotalAnalyzer: Requesting report...
VirusTotalAnalyzer: Response code: 1
VirusTotalAnalyzer: Message: Scan finished, information embedded
VirusTotalAnalyzer: Scan ID: 2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36-1627821009
VirusTotalAnalyzer: Detection ratio: 0/54
VirusTotalAnalyzer: Scan date: 2021-08-01 12:30:09
VirusTotalAnalyzer: Permalink: https://www.virustotal.com/gui/file/2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36/detection/f-2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36-1627821009
{'Output': {'virus_total_analyzer_summary_result': {'data': {'name': 'R.pkg',
                                                             'permalink': 'https://www.virustotal.com/gui/file/2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36/detection/f-2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36-1627821009',
                                                             'ratio': '0/54'},
                                                    'report_fields': ['name',
                                                                      'ratio',
                                                                      'permalink'],
                                                    'summary_text': 'The '
                                                                    'following '
                                                                    'items '
                                                                    'were '
                                                                    'queried '
                                                                    'from the '
                                                                    'VirusTotal '
                                                                    'database:'}}}
Receipt written to /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/receipts/Rtest-receipt-20210803-120725.plist

The following new items were downloaded:
    Download Path                                                                        
    -------------                                                                        
    /Users/autopkgadmin/Library/AutoPkg/Cache/io.github.hjuutilainen.munki.R/downloads/R.pkg  

The following items were queried from the VirusTotal database:
    Name   Ratio  Permalink                                                                                                                                                                                     
    ----   -----  ---------                                                                                                                                                                                     
    R.pkg  0/54   https://www.virustotal.com/gui/file/2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36/detection/f-2974eff8401ebd00d580fd98ba1a96352cc8924358443d41c8bdb66e358d7f36-1627821009  
hjuutilainen commented 2 years ago

Thank you very much for the PR!