thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
210 stars 54 forks source link

fix: improve compatibility of user/group existence check in package maintainer scripts #2942

Closed reubenmiller closed 2 weeks ago

reubenmiller commented 2 weeks ago

Proposed changes

Improve the compatibility across different linux/bsd distributions when checking for the existence of users or groups during the installation and remove of thin-edge.io.

The new logic will checks for the existence of the dependent tool before using it, and if not found will continue to the next tool, the order is as follows:

  1. id
  2. getent
  3. grep /etc/passwd (user) or grep /etc/group (groups) - Though this is only a last resort and will not work reliably on distributions that use some exotic NSS setup, like Fedora IoT, however in the majority of cases, id SHOULD be installed.

There is another related PR regarding the thin-edge.io/install.sh script which also used getent by default:

Types of changes

Paste Link to the issue

https://github.com/thin-edge/thin-edge.io/issues/2941

Checklist

Further comments

github-actions[bot] commented 2 weeks ago

Robot Results

:white_check_mark: Passed :x: Failed :next_track_button: Skipped Total Pass % :stopwatch: Duration
453 0 3 453 100 58m4.227015s