Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check generated tmpfiles.d dir when removing package #4746

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/libpriv/rpmostree-core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3086,10 +3086,25 @@ delete_package_from_root (RpmOstreeContext *self, rpmte pkg, int rootfs_dfd, GHa
}

/* And finally, delete any automatically generated tmpfiles.d dropin. */
const char *tmpfiles_path = "usr/lib/rpm-ostree/tmpfiles.d";
/* Check if the new rpm-ostree tmpfiles.d directory exists;
* if not, switch to old tmpfiles.d directory.
*/
if (!glnx_fstatat_allow_noent (rootfs_dfd, tmpfiles_path, NULL, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
glnx_autofd int tmpfiles_dfd = -1;
if (!glnx_opendirat (rootfs_dfd, "usr/lib/rpm-ostree/tmpfiles.d", TRUE, &tmpfiles_dfd, error))
g_autofree char *dropin = NULL;
if (errno == 0)
{
dropin = g_strdup_printf ("%s.conf", rpmteN (pkg));
}
else if (errno == ENOENT)
{
tmpfiles_path = "usr/lib/tmpfiles.d";
dropin = g_strdup_printf ("pkg-%s.conf", rpmteN (pkg));
}
if (!glnx_opendirat (rootfs_dfd, tmpfiles_path, TRUE, &tmpfiles_dfd, error))
return FALSE;
g_autofree char *dropin = g_strdup_printf ("%s.conf", rpmteN (pkg));
if (!glnx_shutil_rm_rf_at (tmpfiles_dfd, dropin, cancellable, error))
return FALSE;

Expand Down