{"action":"created","comment":{"url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/comments/229486725","pull_request_review_id":169999725,"id":229486725,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyOTQ4NjcyNQ==","diff_hunk":"@@ -30,42 +30,110 @@\n import plistlib\n import subprocess\n import sys\n-import time\n import urlparse\n import xattr\n from xml.dom import minidom\n from xml.parsers.expat import ExpatError\n+from distutils.version import LooseVersion\n \n \n-DEFAULT_SUCATALOG = (\n-    'https://swscan.apple.com/content/catalogs/others/'\n-    'index-10.13seed-10.13-10.12-10.11-10.10-10.9'\n-    '-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz')\n+DEFAULT_SUCATALOGS = {\n+    '17': 'https://swscan.apple.com/content/catalogs/others/'\n+          'index-10.13-10.12-10.11-10.10-10.9'\n+          '-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog',\n+    '18': 'https://swscan.apple.com/content/catalogs/others/'\n+          'index-10.14-10.13-10.12-10.11-10.10-10.9'\n+          '-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog',\n+}\n+\n \n SEED_CATALOGS_PLIST = (\n     '/System/Library/PrivateFrameworks/Seeding.framework/Versions/Current/'\n     'Resources/SeedCatalogs.plist'\n )\n \n \n+def get_board_id():\n+    '''Gets the local system board ID'''\n+    ioreg_cmd = ['ioreg', '-p', 'IODeviceTree', '-r', '-n', '/', '-d', '1']\n+    try:\n+        ioreg_output = subprocess.check_output(ioreg_cmd).splitlines()\n+        for line in ioreg_output:\n+            if 'board-id' in line:\n+                board_id = line.split(\" \")[-1]\n+                board_id = board_id[board_id.find('<\"')+2:board_id.find('\">')]\n+                return board_id\n+    except subprocess.CalledProcessError, err:\n+        raise ReplicationError(err)\n+\n+\n+def is_a_vm():\n+    '''Determines if the script is being run in a virtual machine'''\n+    sysctl_cmd = ['/usr/sbin/sysctl', 'machdep.cpu.features']\n+    try:\n+        sysctl_output = subprocess.check_output(sysctl_cmd)\n+        cpu_features = sysctl_output.split(\" \")\n+        is_vm = False\n+        for i in range(len(cpu_features)):\n+            if cpu_features[i] == \"VMM\":\n+                is_vm = True\n+    except subprocess.CalledProcessError, err:\n+        raise ReplicationError(err)\n+    return is_vm\n+\n+\n+def get_hw_model():\n+    '''Gets the local system ModelIdentifier'''\n+    sysctl_cmd = ['/usr/sbin/sysctl', 'hw.model']\n+    try:\n+        sysctl_output = subprocess.check_output(sysctl_cmd)\n+        hw_model = sysctl_output.split(\" \")[-1].split(\"\\n\")[0]\n+    except subprocess.CalledProcessError, err:\n+        raise ReplicationError(err)","path":"installinstallmacos.py","position":68,"original_position":68,"commit_id":"db6fa3588dd0686da8dcf2ef7c5c1d9020fd4dcd","original_commit_id":"db6fa3588dd0686da8dcf2ef7c5c1d9020fd4dcd","user":{"login":"gregneagle","id":700560,"node_id":"MDQ6VXNlcjcwMDU2MA==","avatar_url":"https://avatars0.githubusercontent.com/u/700560?v=4","gravatar_id":"","url":"https://api.github.com/users/gregneagle","html_url":"https://github.com/gregneagle","followers_url":"https://api.github.com/users/gregneagle/followers","following_url":"https://api.github.com/users/gregneagle/following{/other_user}","gists_url":"https://api.github.com/users/gregneagle/gists{/gist_id}","starred_url":"https://api.github.com/users/gregneagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregneagle/subscriptions","organizations_url":"https://api.github.com/users/gregneagle/orgs","repos_url":"https://api.github.com/users/gregneagle/repos","events_url":"https://api.github.com/users/gregneagle/events{/privacy}","received_events_url":"https://api.github.com/users/gregneagle/received_events","type":"User","site_admin":false},"body":"ReplicationError seems the wrong error to raise -- this has nothing to do with replicating the files from Apple\r\n","created_at":"2018-10-30T21:08:10Z","updated_at":"2018-10-30T21:19:00Z","html_url":"https://github.com/munki/macadmin-scripts/pull/11#discussion_r229486725","pull_request_url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/comments/229486725"},"html":{"href":"https://github.com/munki/macadmin-scripts/pull/11#discussion_r229486725"},"pull_request":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11","id":227075560,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3MDc1NTYw","html_url":"https://github.com/munki/macadmin-scripts/pull/11","diff_url":"https://github.com/munki/macadmin-scripts/pull/11.diff","patch_url":"https://github.com/munki/macadmin-scripts/pull/11.patch","issue_url":"https://api.github.com/repos/munki/macadmin-scripts/issues/11","number":11,"state":"open","locked":false,"title":"Displays hardware information and identifies incompatible builds","user":{"login":"grahampugh","id":5802725,"node_id":"MDQ6VXNlcjU4MDI3MjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5802725?v=4","gravatar_id":"","url":"https://api.github.com/users/grahampugh","html_url":"https://github.com/grahampugh","followers_url":"https://api.github.com/users/grahampugh/followers","following_url":"https://api.github.com/users/grahampugh/following{/other_user}","gists_url":"https://api.github.com/users/grahampugh/gists{/gist_id}","starred_url":"https://api.github.com/users/grahampugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahampugh/subscriptions","organizations_url":"https://api.github.com/users/grahampugh/orgs","repos_url":"https://api.github.com/users/grahampugh/repos","events_url":"https://api.github.com/users/grahampugh/events{/privacy}","received_events_url":"https://api.github.com/users/grahampugh/received_events","type":"User","site_admin":false},"body":"Hi Greg\r\n\r\nTo start the process of breaking down my updates to this script to see if you are interested in merging it, I have created a new branch. \r\n\r\nIn this branch, I have merged in all your upstream changes regarding catalog choice and post date, and added the part of my `master` fork which identifies the current hardware on which the script is being run. The initial output of the script is therefore as in this example:\r\n\r\n```\r\n$ sudo python installinstallmacos.py \r\n\r\ninstallinstallmacos.py - get macOS installers from the Apple software catalog\r\n\r\nThis Mac:\r\nModel Identifier : MacBookPro14,2\r\nBoard ID         : Mac-CAD6701F7CEA0921\r\nOS Version       : 10.14\r\nBuild ID         : 18A391\r\n```\r\n\r\nNote that the script also checks for a VM. This results in an additional line when a VM is identified: \r\n\r\n```\r\nIdentified as a Virtual Machine\r\n``` \r\n\r\nI added a new column to the list of items called `Notes`, which displays a string if the listed build is incompatible with the current hardware, either of:\r\n\r\n* `Unsupported Model Identifier`\r\n* `Unsupported macOS version`\r\n* `Unsupported Board ID`\r\n\r\nThis results in an output as in this example run on a T2 MBP running macOS 10.14.0:\r\n\r\n```\r\n #  ProductID       Version    Build    Post Date   Title                          Notes\r\n 1  041-08708       10.14      18A391   2018-09-24  macOS Mojave                   \r\n 2  091-93471       10.14.1    18B75    2018-10-30  macOS Mojave                   \r\n 3  091-94326       10.13.6    17G65    2018-07-11  macOS High Sierra              Unsupported macOS version\r\n 4  091-95774       10.13.6    17G2208  2018-07-30  macOS High Sierra              Unsupported Board ID\r\n```\r\n\r\nIn this branch's commit, the script then proceeds as normal. \r\n\r\nThese hardware checks are the groundwork for adding the ability to automate the correct build based on some additional arguments. I have not added those into the PR yet, so as to maintain clarity, and will await feedback on these changes before adding them. I leave the other PR in place, in case you want to cross-reference what I'm ultimately trying to achieve.","created_at":"2018-10-30T20:46:35Z","updated_at":"2018-10-30T21:18:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11/commits","review_comments_url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11/comments","review_comment_url":"https://api.github.com/repos/munki/macadmin-scripts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/munki/macadmin-scripts/issues/11/comments","statuses_url":"https://api.github.com/repos/munki/macadmin-scripts/statuses/db6fa3588dd0686da8dcf2ef7c5c1d9020fd4dcd","head":{"label":"grahampugh:validation","ref":"validation","sha":"db6fa3588dd0686da8dcf2ef7c5c1d9020fd4dcd","user":{"login":"grahampugh","id":5802725,"node_id":"MDQ6VXNlcjU4MDI3MjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5802725?v=4","gravatar_id":"","url":"https://api.github.com/users/grahampugh","html_url":"https://github.com/grahampugh","followers_url":"https://api.github.com/users/grahampugh/followers","following_url":"https://api.github.com/users/grahampugh/following{/other_user}","gists_url":"https://api.github.com/users/grahampugh/gists{/gist_id}","starred_url":"https://api.github.com/users/grahampugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahampugh/subscriptions","organizations_url":"https://api.github.com/users/grahampugh/orgs","repos_url":"https://api.github.com/users/grahampugh/repos","events_url":"https://api.github.com/users/grahampugh/events{/privacy}","received_events_url":"https://api.github.com/users/grahampugh/received_events","type":"User","site_admin":false},"repo":{"id":139733033,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk3MzMwMzM=","name":"macadmin-scripts","full_name":"grahampugh/macadmin-scripts","private":false,"owner":{"login":"grahampugh","id":5802725,"node_id":"MDQ6VXNlcjU4MDI3MjU=","avatar_url":"https://avatars1.githubusercontent.com/u/5802725?v=4","gravatar_id":"","url":"https://api.github.com/users/grahampugh","html_url":"https://github.com/grahampugh","followers_url":"https://api.github.com/users/grahampugh/followers","following_url":"https://api.github.com/users/grahampugh/following{/other_user}","gists_url":"https://api.github.com/users/grahampugh/gists{/gist_id}","starred_url":"https://api.github.com/users/grahampugh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grahampugh/subscriptions","organizations_url":"https://api.github.com/users/grahampugh/orgs","repos_url":"https://api.github.com/users/grahampugh/repos","events_url":"https://api.github.com/users/grahampugh/events{/privacy}","received_events_url":"https://api.github.com/users/grahampugh/received_events","type":"User","site_admin":false},"html_url":"https://github.com/grahampugh/macadmin-scripts","description":"Scripts of possible interest to macOS admins","fork":true,"url":"https://api.github.com/repos/grahampugh/macadmin-scripts","forks_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/forks","keys_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/teams","hooks_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/hooks","issue_events_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/events","assignees_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/tags","blobs_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/languages","stargazers_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/stargazers","contributors_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/contributors","subscribers_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/subscribers","subscription_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/subscription","commits_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/merges","archive_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/downloads","issues_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/labels{/name}","releases_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/grahampugh/macadmin-scripts/deployments","created_at":"2018-07-04T14:31:27Z","updated_at":"2018-10-30T18:08:00Z","pushed_at":"2018-10-30T20:32:07Z","git_url":"git://github.com/grahampugh/macadmin-scripts.git","ssh_url":"git@github.com:grahampugh/macadmin-scripts.git","clone_url":"https://github.com/grahampugh/macadmin-scripts.git","svn_url":"https://github.com/grahampugh/macadmin-scripts","homepage":null,"size":64,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"munki:master","ref":"master","sha":"c0cdf39725c517225c6115ea09ba5703549d8aea","user":{"login":"munki","id":8826633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4MjY2MzM=","avatar_url":"https://avatars3.githubusercontent.com/u/8826633?v=4","gravatar_id":"","url":"https://api.github.com/users/munki","html_url":"https://github.com/munki","followers_url":"https://api.github.com/users/munki/followers","following_url":"https://api.github.com/users/munki/following{/other_user}","gists_url":"https://api.github.com/users/munki/gists{/gist_id}","starred_url":"https://api.github.com/users/munki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munki/subscriptions","organizations_url":"https://api.github.com/users/munki/orgs","repos_url":"https://api.github.com/users/munki/repos","events_url":"https://api.github.com/users/munki/events{/privacy}","received_events_url":"https://api.github.com/users/munki/received_events","type":"Organization","site_admin":false},"repo":{"id":110171937,"node_id":"MDEwOlJlcG9zaXRvcnkxMTAxNzE5Mzc=","name":"macadmin-scripts","full_name":"munki/macadmin-scripts","private":false,"owner":{"login":"munki","id":8826633,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4MjY2MzM=","avatar_url":"https://avatars3.githubusercontent.com/u/8826633?v=4","gravatar_id":"","url":"https://api.github.com/users/munki","html_url":"https://github.com/munki","followers_url":"https://api.github.com/users/munki/followers","following_url":"https://api.github.com/users/munki/following{/other_user}","gists_url":"https://api.github.com/users/munki/gists{/gist_id}","starred_url":"https://api.github.com/users/munki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munki/subscriptions","organizations_url":"https://api.github.com/users/munki/orgs","repos_url":"https://api.github.com/users/munki/repos","events_url":"https://api.github.com/users/munki/events{/privacy}","received_events_url":"https://api.github.com/users/munki/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/munki/macadmin-scripts","description":"Scripts of possible interest to macOS admins","fork":false,"url":"https://api.github.com/repos/munki/macadmin-scripts","forks_url":"https://api.github.com/repos/munki/macadmin-scripts/forks","keys_url":"https://api.github.com/repos/munki/macadmin-scripts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/munki/macadmin-scripts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/munki/macadmin-scripts/teams","hooks_url":"https://api.github.com/repos/munki/macadmin-scripts/hooks","issue_events_url":"https://api.github.com/repos/munki/macadmin-scripts/issues/events{/number}","events_url":"https://api.github.com/repos/munki/macadmin-scripts/events","assignees_url":"https://api.github.com/repos/munki/macadmin-scripts/assignees{/user}","branches_url":"https://api.github.com/repos/munki/macadmin-scripts/branches{/branch}","tags_url":"https://api.github.com/repos/munki/macadmin-scripts/tags","blobs_url":"https://api.github.com/repos/munki/macadmin-scripts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/munki/macadmin-scripts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/munki/macadmin-scripts/git/refs{/sha}","trees_url":"https://api.github.com/repos/munki/macadmin-scripts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/munki/macadmin-scripts/statuses/{sha}","languages_url":"https://api.github.com/repos/munki/macadmin-scripts/languages","stargazers_url":"https://api.github.com/repos/munki/macadmin-scripts/stargazers","contributors_url":"https://api.github.com/repos/munki/macadmin-scripts/contributors","subscribers_url":"https://api.github.com/repos/munki/macadmin-scripts/subscribers","subscription_url":"https://api.github.com/repos/munki/macadmin-scripts/subscription","commits_url":"https://api.github.com/repos/munki/macadmin-scripts/commits{/sha}","git_commits_url":"https://api.github.com/repos/munki/macadmin-scripts/git/commits{/sha}","comments_url":"https://api.github.com/repos/munki/macadmin-scripts/comments{/number}","issue_comment_url":"https://api.github.com/repos/munki/macadmin-scripts/issues/comments{/number}","contents_url":"https://api.github.com/repos/munki/macadmin-scripts/contents/{+path}","compare_url":"https://api.github.com/repos/munki/macadmin-scripts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/munki/macadmin-scripts/merges","archive_url":"https://api.github.com/repos/munki/macadmin-scripts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/munki/macadmin-scripts/downloads","issues_url":"https://api.github.com/repos/munki/macadmin-scripts/issues{/number}","pulls_url":"https://api.github.com/repos/munki/macadmin-scripts/pulls{/number}","milestones_url":"https://api.github.com/repos/munki/macadmin-scripts/milestones{/number}","notifications_url":"https://api.github.com/repos/munki/macadmin-scripts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/munki/macadmin-scripts/labels{/name}","releases_url":"https://api.github.com/repos/munki/macadmin-scripts/releases{/id}","deployments_url":"https://api.github.com/repos/munki/macadmin-scripts/deployments","created_at":"2017-11-09T22:11:18Z","updated_at":"2018-10-29T16:50:32Z","pushed_at":"2018-10-30T20:46:36Z","git_url":"git://github.com/munki/macadmin-scripts.git","ssh_url":"git@github.com:munki/macadmin-scripts.git","clone_url":"https://github.com/munki/macadmin-scripts.git","svn_url":"https://github.com/munki/macadmin-scripts","homepage":null,"size":38,"stargazers_count":264,"watchers_count":264,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":39,"open_issues":2,"watchers":264,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11"},"html":{"href":"https://github.com/munki/macadmin-scripts/pull/11"},"issue":{"href":"https://api.github.com/repos/munki/macadmin-scripts/issues/11"},"comments":{"href":"https://api.github.com/repos/munki/macadmin-scripts/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/munki/macadmin-scripts/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/munki/macadmin-scripts/statuses/db6fa3588dd0686da8dcf2ef7c5c1d9020fd4dcd"}},"author_association":"NONE"}}
{"actor":{"display_login":"gregneagle"}}