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 <andrei.gherzan@huawei.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andrei Gherzan
2022-08-25 18:30:40 +02:00
committed by Richard Purdie
parent 5ec20bf952
commit c917d00ea3

View File

@@ -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)