thin-edge / thin-edge.io

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

Avoid modifying files if they are up to date in `tedge init` #2876

Closed jarhodes314 closed 1 month ago

jarhodes314 commented 1 month ago

Proposed changes

tedge init was blindly recreating symlinks for the tedge components, even if those symlinks existed. This was causing problems running thin-edge on read-only file-systems. This PR adds checks to establish if the symlinks need to change, and avoids changing them if not. It also makes a similar change to some permission changes further through the process.

Testing on my local machine, I can now run tedge init successfully with the default settings without using sudo, so it doesn't appear to be attempting to modify any files following these changes.

Types of changes

Paste Link to the issue

Checklist

Further comments

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 62.24490% with 74 lines in your changes are missing coverage. Please review.

Project coverage is 77.9%. Comparing base (2fad9e8) to head (c89b62a). Report is 20 commits behind head on main.

Additional details and impacted files | [Files](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2876?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge) | Coverage Δ | | |---|---|---| | [crates/common/tedge\_utils/src/file.rs](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2876?src=pr&el=tree&filepath=crates%2Fcommon%2Ftedge_utils%2Fsrc%2Ffile.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge#diff-Y3JhdGVzL2NvbW1vbi90ZWRnZV91dGlscy9zcmMvZmlsZS5ycw==) | `70.3% <46.6%> (-0.2%)` | :arrow_down: | | [crates/core/tedge/src/cli/init.rs](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2876?src=pr&el=tree&filepath=crates%2Fcore%2Ftedge%2Fsrc%2Fcli%2Finit.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge#diff-Y3JhdGVzL2NvcmUvdGVkZ2Uvc3JjL2NsaS9pbml0LnJz) | `48.5% <63.5%> (+48.5%)` | :arrow_up: | ... and [23 files with indirect coverage changes](https://app.codecov.io/gh/thin-edge/thin-edge.io/pull/2876/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=thin-edge)
github-actions[bot] commented 1 month ago

Robot Results

:white_check_mark: Passed :x: Failed :next_track_button: Skipped Total Pass % :stopwatch: Duration
433 0 3 433 100 55m24.316861999s