Skip to content

Fix clean up of old image files - #787

Merged
DavidePrincipi merged 5 commits into
mainfrom
bug-7058
Jan 23, 2025
Merged

DavidePrincipi merged 5 commits into
mainfrom
bug-7058

Conversation

@DavidePrincipi

Copy link
Copy Markdown
Member

When a new image is extracted in the AGENT_INSTALL_DIR, files and directories of the previous image version that are no longer required must be removed.

This change to Core will be effective after the second next module update because on the first pass the .imageroot.lst file is fixed by removing the leading "imageroot/" prefix. On the second update the comparison starts to work correctly.

For example. The first update the instance is updated:

  • .imageroot.lst starts with ./actions
  • .imageroot.lst~ starts with imageroot/actions

No file and dir is removed automatically. Then the second time the instance is updated:

  • .imageroot.lst starts with ./actions
  • .imageroot.lst~ starts with ./actions

If a file or dir is not present in the second image, extract-image calls rm/rmdir on it to reflect the change in the filesystem.

Refs NethServer/dev#7058

Ensure extract-image is not run concurrently, like the similar command
install-coreimage.
Align the list of files and dirs from the module image to paths relative
to the current working directory (normally AGENT_INSTALL_DIR). When
rm/rmdir are invoked in this script the entry path must match the
filesystem path to work properly.
@DavidePrincipi DavidePrincipi self-assigned this Jan 22, 2025
Parent directories must be removed only when they are emptied from files
and child dirs. Iterate the directory list in reverse-sort order to
ensure parent removal after children.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants