{"action":"created","issue":{"url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/57","repository_url":"https://api.github.com/repos/rootzoll/raspiblitz","labels_url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/57/comments","events_url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/57/events","html_url":"https://github.com/rootzoll/raspiblitz/issues/57","id":354043569,"node_id":"MDU6SXNzdWUzNTQwNDM1Njk=","number":57,"title":"missing permissions (here still inline sudo)","user":{"login":"vv01f","id":3034896,"node_id":"MDQ6VXNlcjMwMzQ4OTY=","avatar_url":"https://avatars2.githubusercontent.com/u/3034896?v=4","gravatar_id":"","url":"https://api.github.com/users/vv01f","html_url":"https://github.com/vv01f","followers_url":"https://api.github.com/users/vv01f/followers","following_url":"https://api.github.com/users/vv01f/following{/other_user}","gists_url":"https://api.github.com/users/vv01f/gists{/gist_id}","starred_url":"https://api.github.com/users/vv01f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vv01f/subscriptions","organizations_url":"https://api.github.com/users/vv01f/orgs","repos_url":"https://api.github.com/users/vv01f/repos","events_url":"https://api.github.com/users/vv01f/events{/privacy}","received_events_url":"https://api.github.com/users/vv01f/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-25T21:08:38Z","updated_at":"2018-08-27T20:39:26Z","closed_at":null,"author_association":"NONE","body":"https://github.com/rootzoll/raspiblitz/blob/77a8f90402cc3a17be98394854b546ec22c89376/build.sdcard/raspbianStretchDesktop.sh#L235\r\n\r\nstill in dir `/home/admin/download` and current user will not have write permission for wget\r\n\r\nas well as\r\n\r\nhttps://github.com/rootzoll/raspiblitz/blob/77a8f90402cc3a17be98394854b546ec22c89376/build.sdcard/raspbianStretchDesktop.sh#L327\r\n\r\n and\r\n\r\nhttps://github.com/rootzoll/raspiblitz/blob/77a8f90402cc3a17be98394854b546ec22c89376/build.sdcard/raspbianStretchDesktop.sh#L328\r\n\r\nin  dir `/home/admin`\r\n\r\nI suggest\r\n\r\n1. putting grouped commands such as installation for bitcoin, litecoind and lightning in functions, this way the user can be set on calling the function rather than on every command – also it would make it easier to have the user calling e.g. to install litecoin but not bitcoin or any other combination of provided other client/blockchain etc. \r\n2. before proceeding with a file, check `test -f ${fn}` is recommended or check on success for previous command (with e.g. `&&` or `test $? -eq 0`)\r\n3. checking once in the beginning of a script if the needed rights are given and reject any execution if so, e.g.:\r\n\r\n```\r\n#!/bin/sh\r\n# first check if user is root or script was run with privileges (e.g. sudo)\r\n# such functions can be written once in a library-script\r\n# and used several times after `source lib.sh` \r\nfunction requireRights() {\r\n  {\r\n    test \"$UID\" = \"0\" || test \"$EUID\" = \"0\" || test $(id -u) -eq 0\r\n  } || {\r\n    printf \"%s\\n\" \"This script must be run with root privileges!\" 1>&2 && exit 1\r\n  }\r\n}\r\n\r\nrequireRights\r\n```"},"comment":{"url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/comments/416360797","html_url":"https://github.com/rootzoll/raspiblitz/issues/57#issuecomment-416360797","issue_url":"https://api.github.com/repos/rootzoll/raspiblitz/issues/57","id":416360797,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjM2MDc5Nw==","user":{"login":"rootzoll","id":2472225,"node_id":"MDQ6VXNlcjI0NzIyMjU=","avatar_url":"https://avatars2.githubusercontent.com/u/2472225?v=4","gravatar_id":"","url":"https://api.github.com/users/rootzoll","html_url":"https://github.com/rootzoll","followers_url":"https://api.github.com/users/rootzoll/followers","following_url":"https://api.github.com/users/rootzoll/following{/other_user}","gists_url":"https://api.github.com/users/rootzoll/gists{/gist_id}","starred_url":"https://api.github.com/users/rootzoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rootzoll/subscriptions","organizations_url":"https://api.github.com/users/rootzoll/orgs","repos_url":"https://api.github.com/users/rootzoll/repos","events_url":"https://api.github.com/users/rootzoll/events{/privacy}","received_events_url":"https://api.github.com/users/rootzoll/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T20:39:26Z","updated_at":"2018-08-27T20:39:26Z","author_association":"OWNER","body":"The go zip gets deleted after installed - so should be OK there.\r\nThe LCD-show i will let own the admin in the future.\r\nThe raspbianStretchDesktop.sh is used just once with user pi if user wants to build own SD card image - so I like to keep it linear - functions maybe a bit to much at this point.\r\nTo add some checkpoints if files exist (to check on success of prior actions) makes sense to prevent follow up errors. Thanks for the input."}}
{"actor":{"display_login":"rootzoll"}}