summaryrefslogtreecommitdiff
path: root/src/shared/edit-util.h
Commit message (Collapse)AuthorAgeFilesLines
* edit-util: introduce overwrite_with_origin switchMike Yuan2023-04-071-0/+1
| | | | | | | Before this commit, if `original_path` is given, it will always be used to overwrite `path`. After this commit, it's controlled by the newly-added switch `overwrite_with_origin`.
* edit-util: add DROPIN_MARKER_{START,END}Mike Yuan2023-04-071-0/+3
|
* edit-util: include the correct headerMike Yuan2023-03-131-1/+1
|
* edit-util: make EditFile take reference of EditFileContextYu Watanabe2023-03-111-4/+8
| | | | No functional change, just preparation for later commits.
* edit-util: introduce EditFileContextMike Yuan2023-03-111-12/+19
| | | | | | | | | | | | | | | | | | This is a rather large change which moves the add and install logic into edit-util. We store an EditFile array and the number of elements, along with the edit markers used in temporary files and whether to remove the parent directories of the target files if they're empty in an EditFileContext object. Call edit_files_add() to add an file to edit, and do_edit_files_and_install() to do the actual editing (through create_edit_temp_file(), run_editor() and trim_edit_markers()). After that, edit_file_context_done() can be used to destroy the object.
* edit-util: several cleanups to create_edit_temp_fileMike Yuan2023-03-111-3/+3
| | | | | | | original_path and comment_paths can now be used together. Removes reference to "unit"
* shared: extract edit-util from systemctl-editMike Yuan2023-03-111-0/+25