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:
id
getent
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:
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:
id
getent
grep /etc/passwd
(user) orgrep /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
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments