summaryrefslogtreecommitdiffstats
path: root/meta/lib/rootfspostcommands.py
AgeCommit message (Collapse)Author
2022-08-25rootfspostcommands.py: Cleanup subid backup files generated by shadow-utilsAndrei Gherzan
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. (From OE-Core rev: 4e4ea5adea8a00b4a78ffbe7cc60931deb74c161) Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-25rootfspostcommands.py: Restructure sort_passwd and related functionsAndrei Gherzan
This change proposes a restructure of the functions in rootfspostcommandstests.py to clarify the purpose of each function and also, make it scalable for other use cases (for example adding support for removing subid backup files). The main function of interest here is 'tidy_shadowutils_files' which brings in the functionality of the old 'sort_passwd' making it clear that it doesn't only sort the passwd file: - delete backup files - it sorts passwd, group and the associated shadow files The other functions are also renamed for consistency and clarity and more documentation was added. (From OE-Core rev: 81a0a4dbfb0313b967a7a98eb7fd1e13edb1a9be) Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-12lib: Add copyright statements to files without oneRichard Purdie
Where there isn't a copyright statement, add one to make it explicit. Also add license identifiers as MIT if there isn't one. (From OE-Core rev: bb731d1f3d2a1d50ec0aed864dbca54cf795b040) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09meta/lib+scripts: Convert to SPDX license headersRichard Purdie
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19rootfspostcommands: remove shadow backup files instead of trying to sortPatrick Ohly
Backup are files sometimes are inconsistent and then cannot be sorted (YOCTO #11043), and more importantly, are not needed in the initial rootfs, so they get deleted. Fixes: [YOCTO #11007] (From OE-Core rev: e5628c80a52f3caeea9d9dc7f67d1b8a61222aef) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-16rootfs-postcommands.bbclass: sort passwd entriesPatrick Ohly
The /etc passwd files in a rootfs consist of the default entries from base-passwd plus anything that gets added via package installation, EXTRA_USERS_PARAMS and/or system sysusers. The execution order of preinst scripts is not perfectly deterministic, or at least unrelated changes caused it to change in a non-deterministic way, resulting in irrelevant changes in the order of passwd entries. useradd-staticids.bbclass ensures that the numeric IDs don't change, but re-ordering can still occur, which is bad for reproducible builds and file-based update mechanisms like swupd which work best if changes are as minimal as possible. To achieve that, the files get sorted in a post-processing command, enabled by default. Sorting is based primarily on the numeric IDs, so for example, the "root" user continues to be listed first. "nobody" now is at the end, which wasn't the case before. The order of the entries should not matter, but in obscure cases where it does (like having multiple entries for the same numeric ID) this behavior can be disabled by setting SORT_PASSWD_POSTPROCESS_COMMAND to an empty string. Fixes: YOCTO #10520 (From OE-Core rev: ba684f436908ac2300a00c174d5aa06b4f824367) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>