From c917d00ea33b90109ca38ebc964f9b9cce5cf2b5 Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Thu, 25 Aug 2022 18:30:40 +0200 Subject: [PATCH] rootfspostcommands.py: Cleanup subid backup files generated by shadow-utils When creating users, shadow-utils might create backup files for subordinate ID files (subid, subgid). Make sure we clean them up similarly to the other backup files shadow-utils creates. This is a backport from master that brings in only the cleanup of the subid backup files without the code restructure. (From OE-Core rev: 84b2e9a6c17278cbcc08020aa78759004a7b60bf) Signed-off-by: Andrei Gherzan Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- meta/lib/rootfspostcommands.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/lib/rootfspostcommands.py b/meta/lib/rootfspostcommands.py index fdb9f5b850..12f66d2ce2 100644 --- a/meta/lib/rootfspostcommands.py +++ b/meta/lib/rootfspostcommands.py @@ -58,3 +58,10 @@ def sort_passwd(sysconfdir): remove_backup(filename) if os.path.exists(filename): sort_file(filename, mapping) + # Drop other known backup shadow-utils. + for filename in ( + 'subgid', + 'subuid', + ): + filepath = os.path.join(sysconfdir, filename) + remove_backup(filepath)