{"action":"created","comment":{"url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/comments/81124028","pull_request_review_id":2125651,"id":81124028,"diff_hunk":"@@ -0,0 +1,93 @@\n+#!/bin/bash\n+# Copyright (C) 2016 Endless Mobile, Inc.\n+# Licensed under the GPLv2\n+#\n+# When booting from an image file hosted on a filesystem, this program maps the\n+# host filesystem to a dm-device with a hole where the image file lives.\n+\n+for i in $(</proc/cmdline); do\n+  case $i in\n+  endless.image.device=*)\n+    host_device=${i//endless.image.device=}\n+    ;;\n+  endless.image.path=*)\n+    image_path=${i//endless.image.path=}\n+    ;;\n+  esac\n+done\n+\n+dm_roflag=\"--readonly\"\n+\n+[ -z \"${host_device}\" -o -z \"${image_path}\" ] && exit 1\n+\n+case \"${host_device}\" in\n+PARTUUID=*)\n+  host_device=/dev/disk/by-partuuid/${host_device#PARTUUID=}\n+  ;;\n+UUID=*)\n+  host_device=/dev/disk/by-uuid/${host_device#UUID=}\n+  ;;\n+esac\n+\n+host_device_size=$(blockdev --getsz ${host_device})\n+if [ $? != 0 ]; then\n+  echo \"Failed to read ${host_device} size\"\n+  exit 1\n+fi\n+\n+fstype=$(blkid -o value -s TYPE \"${host_device}\")\n+if [ $? != 0 ]; then\n+  echo \"Failed to detect filesystem type on ${host_device}\"\n+  exit 1\n+fi\n+\n+case \"${fstype}\" in\n+exfat)\n+  extents=$(dumpexfat -f \"${image_path}\" \"${host_device}\")\n+  ;;\n+ntfs)\n+  extents=$(ntfsextents \"${host_device}\" \"${image_path}\")\n+  ;;\n+*)\n+  echo \"Unsupported filesystem ${fstype} on ${host_device}\"\n+  exit 1\n+esac\n+\n+if [ $? != 0 ]; then\n+  echo \"Failed to lookup ${image_path} on ${host_device} (${fstype})\"\n+  exit 1\n+fi\n+\n+# Cleanup the device mapper table file from previous runs\n+rm -f /tmp/dmtable\n+\n+i=0\n+while read extent_i extent_size; do\n+  [ -z \"${extent_i}\" -o -z \"${extent_size}\" ] && continue\n+\n+  if [ $((extent_size % 512)) != 0 ]; then\n+    echo \"Extent size $extent_size is not sector-aligned\"\n+    exit 1\n+  fi\n+\n+  extent_size=$((extent_size / 512))\n+  extent_i=$((extent_i / 512))","path":"eos-image-boot-dm-setup","position":74,"original_position":74,"commit_id":"7c4e696c37efd829df3f4eee3aaeff447c9b92f8","original_commit_id":"8f27a5d4c8f6f602e836065622ba64f324e1809e","user":{"login":"wjt","id":86760,"avatar_url":"https://avatars.githubusercontent.com/u/86760?v=3","gravatar_id":"","url":"https://api.github.com/users/wjt","html_url":"https://github.com/wjt","followers_url":"https://api.github.com/users/wjt/followers","following_url":"https://api.github.com/users/wjt/following{/other_user}","gists_url":"https://api.github.com/users/wjt/gists{/gist_id}","starred_url":"https://api.github.com/users/wjt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjt/subscriptions","organizations_url":"https://api.github.com/users/wjt/orgs","repos_url":"https://api.github.com/users/wjt/repos","events_url":"https://api.github.com/users/wjt/events{/privacy}","received_events_url":"https://api.github.com/users/wjt/received_events","type":"User","site_admin":false},"body":"Yes, fair enough.","created_at":"2016-09-29T12:26:15Z","updated_at":"2016-09-29T12:35:34Z","html_url":"https://github.com/endlessm/eos-boot-helper/pull/65#discussion_r81124028","pull_request_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/comments/81124028"},"html":{"href":"https://github.com/endlessm/eos-boot-helper/pull/65#discussion_r81124028"},"pull_request":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65","id":87003904,"html_url":"https://github.com/endlessm/eos-boot-helper/pull/65","diff_url":"https://github.com/endlessm/eos-boot-helper/pull/65.diff","patch_url":"https://github.com/endlessm/eos-boot-helper/pull/65.patch","issue_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/65","number":65,"state":"open","locked":false,"title":"Provide read-only access to the filesystem hosting endless.img","user":{"login":"jprvita","id":73894,"avatar_url":"https://avatars.githubusercontent.com/u/73894?v=3","gravatar_id":"","url":"https://api.github.com/users/jprvita","html_url":"https://github.com/jprvita","followers_url":"https://api.github.com/users/jprvita/followers","following_url":"https://api.github.com/users/jprvita/following{/other_user}","gists_url":"https://api.github.com/users/jprvita/gists{/gist_id}","starred_url":"https://api.github.com/users/jprvita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jprvita/subscriptions","organizations_url":"https://api.github.com/users/jprvita/orgs","repos_url":"https://api.github.com/users/jprvita/repos","events_url":"https://api.github.com/users/jprvita/events{/privacy}","received_events_url":"https://api.github.com/users/jprvita/received_events","type":"User","site_admin":false},"body":"We are mapping the partition passed in the `endless.image.device=` kernel command line argument to a device mapper device called `host`, and installing the necessary polkit rules to allow for regular users to mount it through the file manager (so a dual-boot user can access its files on the windows partition).\r\n\r\nWhen setting up the dm device, we're mapping the blocks where `endless.img` lives to `error`, so any I/O attempt on them through this dm device fails, adding an additional layer of protection to `endless.img`. This implies that the flasher tool will have to read from dm device which maps `endless.img` and not from the `endless.img` file. Reading from the dm device also should have a better performance than reading from the `endless.img` file, since we will not have to go through FUSE.\r\n\r\nAdditionally, this also hides the partition passed through `endless.image.device=` from the file manager, since it can't be mounted anyway because it is in use by the device mapper.\r\n\r\nhttps://phabricator.endlessm.com/T13135","created_at":"2016-09-27T20:18:31Z","updated_at":"2016-09-29T12:35:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e2d22d5a7d71ec24b26d713dc9a9ec15ed9f1e95","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65/commits","review_comments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65/comments","review_comment_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/65/comments","statuses_url":"https://api.github.com/repos/endlessm/eos-boot-helper/statuses/7c4e696c37efd829df3f4eee3aaeff447c9b92f8","head":{"label":"endlessm:T13135","ref":"T13135","sha":"7c4e696c37efd829df3f4eee3aaeff447c9b92f8","user":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"repo":{"id":17601935,"name":"eos-boot-helper","full_name":"endlessm/eos-boot-helper","owner":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/endlessm/eos-boot-helper","description":"Endless OS services required for booting","fork":false,"url":"https://api.github.com/repos/endlessm/eos-boot-helper","forks_url":"https://api.github.com/repos/endlessm/eos-boot-helper/forks","keys_url":"https://api.github.com/repos/endlessm/eos-boot-helper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endlessm/eos-boot-helper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endlessm/eos-boot-helper/teams","hooks_url":"https://api.github.com/repos/endlessm/eos-boot-helper/hooks","issue_events_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/events{/number}","events_url":"https://api.github.com/repos/endlessm/eos-boot-helper/events","assignees_url":"https://api.github.com/repos/endlessm/eos-boot-helper/assignees{/user}","branches_url":"https://api.github.com/repos/endlessm/eos-boot-helper/branches{/branch}","tags_url":"https://api.github.com/repos/endlessm/eos-boot-helper/tags","blobs_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/refs{/sha}","trees_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endlessm/eos-boot-helper/statuses/{sha}","languages_url":"https://api.github.com/repos/endlessm/eos-boot-helper/languages","stargazers_url":"https://api.github.com/repos/endlessm/eos-boot-helper/stargazers","contributors_url":"https://api.github.com/repos/endlessm/eos-boot-helper/contributors","subscribers_url":"https://api.github.com/repos/endlessm/eos-boot-helper/subscribers","subscription_url":"https://api.github.com/repos/endlessm/eos-boot-helper/subscription","commits_url":"https://api.github.com/repos/endlessm/eos-boot-helper/commits{/sha}","git_commits_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/commits{/sha}","comments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/comments{/number}","issue_comment_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/comments{/number}","contents_url":"https://api.github.com/repos/endlessm/eos-boot-helper/contents/{+path}","compare_url":"https://api.github.com/repos/endlessm/eos-boot-helper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endlessm/eos-boot-helper/merges","archive_url":"https://api.github.com/repos/endlessm/eos-boot-helper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endlessm/eos-boot-helper/downloads","issues_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues{/number}","pulls_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls{/number}","milestones_url":"https://api.github.com/repos/endlessm/eos-boot-helper/milestones{/number}","notifications_url":"https://api.github.com/repos/endlessm/eos-boot-helper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endlessm/eos-boot-helper/labels{/name}","releases_url":"https://api.github.com/repos/endlessm/eos-boot-helper/releases{/id}","deployments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/deployments","created_at":"2014-03-10T17:39:28Z","updated_at":"2016-01-12T20:40:56Z","pushed_at":"2016-09-29T12:08:54Z","git_url":"git://github.com/endlessm/eos-boot-helper.git","ssh_url":"git@github.com:endlessm/eos-boot-helper.git","clone_url":"https://github.com/endlessm/eos-boot-helper.git","svn_url":"https://github.com/endlessm/eos-boot-helper","homepage":"","size":155,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"endlessm:master","ref":"master","sha":"21040c31f5d15707fbf9d9feb2b949dd6c660a90","user":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"repo":{"id":17601935,"name":"eos-boot-helper","full_name":"endlessm/eos-boot-helper","owner":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/endlessm/eos-boot-helper","description":"Endless OS services required for booting","fork":false,"url":"https://api.github.com/repos/endlessm/eos-boot-helper","forks_url":"https://api.github.com/repos/endlessm/eos-boot-helper/forks","keys_url":"https://api.github.com/repos/endlessm/eos-boot-helper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endlessm/eos-boot-helper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endlessm/eos-boot-helper/teams","hooks_url":"https://api.github.com/repos/endlessm/eos-boot-helper/hooks","issue_events_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/events{/number}","events_url":"https://api.github.com/repos/endlessm/eos-boot-helper/events","assignees_url":"https://api.github.com/repos/endlessm/eos-boot-helper/assignees{/user}","branches_url":"https://api.github.com/repos/endlessm/eos-boot-helper/branches{/branch}","tags_url":"https://api.github.com/repos/endlessm/eos-boot-helper/tags","blobs_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/refs{/sha}","trees_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endlessm/eos-boot-helper/statuses/{sha}","languages_url":"https://api.github.com/repos/endlessm/eos-boot-helper/languages","stargazers_url":"https://api.github.com/repos/endlessm/eos-boot-helper/stargazers","contributors_url":"https://api.github.com/repos/endlessm/eos-boot-helper/contributors","subscribers_url":"https://api.github.com/repos/endlessm/eos-boot-helper/subscribers","subscription_url":"https://api.github.com/repos/endlessm/eos-boot-helper/subscription","commits_url":"https://api.github.com/repos/endlessm/eos-boot-helper/commits{/sha}","git_commits_url":"https://api.github.com/repos/endlessm/eos-boot-helper/git/commits{/sha}","comments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/comments{/number}","issue_comment_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/comments{/number}","contents_url":"https://api.github.com/repos/endlessm/eos-boot-helper/contents/{+path}","compare_url":"https://api.github.com/repos/endlessm/eos-boot-helper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endlessm/eos-boot-helper/merges","archive_url":"https://api.github.com/repos/endlessm/eos-boot-helper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endlessm/eos-boot-helper/downloads","issues_url":"https://api.github.com/repos/endlessm/eos-boot-helper/issues{/number}","pulls_url":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls{/number}","milestones_url":"https://api.github.com/repos/endlessm/eos-boot-helper/milestones{/number}","notifications_url":"https://api.github.com/repos/endlessm/eos-boot-helper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endlessm/eos-boot-helper/labels{/name}","releases_url":"https://api.github.com/repos/endlessm/eos-boot-helper/releases{/id}","deployments_url":"https://api.github.com/repos/endlessm/eos-boot-helper/deployments","created_at":"2014-03-10T17:39:28Z","updated_at":"2016-01-12T20:40:56Z","pushed_at":"2016-09-29T12:08:54Z","git_url":"git://github.com/endlessm/eos-boot-helper.git","ssh_url":"git@github.com:endlessm/eos-boot-helper.git","clone_url":"https://github.com/endlessm/eos-boot-helper.git","svn_url":"https://github.com/endlessm/eos-boot-helper","homepage":"","size":155,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65"},"html":{"href":"https://github.com/endlessm/eos-boot-helper/pull/65"},"issue":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/65"},"comments":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/endlessm/eos-boot-helper/statuses/7c4e696c37efd829df3f4eee3aaeff447c9b92f8"}}}}
{"actor":{"display_login":"wjt"}}