summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-bootconfig-parser.c
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* lib/bootconfig: Add support for multiple initrd keysJonathan Lebon2020-09-301-2/+71
| | | | | | | Prep for actually teaching the rest of the codebase about this. We keep the primary initrd in the `options` hash table for backwards compatibility.
* lib/bootconfig-parser: Write BLS fragment fields in a deterministic orderJavier Martinez Canillas2019-08-291-1/+23
| | | | | | | | | | | | | | | | | | | | | Currently the BLS fragments fields write is non-determinisitc. The order of the fields will depend on how the iterator of the options GHashTable iterates over the key/value pairs. But some bootloaders expect the fields to be written in a certain order. For example the zipl bootloader (used in the s390x architecture) fails to parse BLS files if the first field is not the 'title' field, since that's used to name the zipl boot sections that are created from the BLS files. Write the fields in a deterministic order, following what is used in the example file of the BootLoaderspec document: https://systemd.io/BOOT_LOADER_SPECIFICATION Related: https://github.com/ostreedev/ostree/issues/1888 Closes: #1904 Approved by: cgwalters
* lib/bootconfig-parser: Remove support to preserve comments in BLS filesJavier Martinez Canillas2019-08-291-37/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OSTree has some logic to preserve comment lines in the BLS fragments, but the BLS fragments are always created on new deployments so the comments are never carried. Also, OSTree never writes BLS fragments with comments so these will only be present in BLS files that were modified outside of OSTree. Something that should be avoided in general. Finally, there is a bug in the logic that causes BLS files to have lines with only a newline character. The ostree_bootconfig_parser_parse_at() function reads the bootconfig file using glnx_fd_readall_utf8() but this function NUL terminates the returned string with the file contents. So when the string is later split using '\n' as delimiter, the last token is set to '\0' and a wrong GVariant will be added to the lines GPtrArray in the OstreeBootconfigParser struct. This will lead to bootconfig files that contains lines with only a newline character, since the key in the GVariant would be set to NUL and won't be present in the options GHashTable of the OstreeBootconfigParser struct. So let's just remove that logic since is never used and makes BLS files to have wrong empty lines. Before this patch: $ tail -n 4 /boot/loader/entries/ostree-1-testos.conf | hexdump -C 00000000 74 69 74 6c 65 20 54 65 73 74 4f 53 20 34 32 20 |title TestOS 42 | 00000010 32 30 31 39 30 38 32 34 2e 30 20 28 6f 73 74 72 |20190824.0 (ostr| 00000020 65 65 29 0a 0a 0a 0a |ee)....| 00000027 After this patch: $ tail -n 4 /boot/loader/entries/ostree-1-testos.conf | hexdump -C 00000000 76 65 72 73 69 6f 6e 20 31 0a 6f 70 74 69 6f 6e |version 1.option| 00000010 73 20 72 6f 6f 74 3d 4c 41 42 45 4c 3d 4d 4f 4f |s root=LABEL=MOO| 00000020 20 71 75 69 65 74 20 6f 73 74 72 65 65 3d 2f 6f | quiet ostree=/o| 00000030 73 74 72 65 65 2f 62 6f 6f 74 2e 31 2f 74 65 73 |stree/boot.1/tes| 00000040 74 6f 73 2f 61 65 34 36 34 39 36 38 30 64 33 65 |tos/ae4649680d3e| 00000050 38 33 62 32 34 65 34 37 66 38 64 66 31 30 38 31 |83b24e47f8df1081| 00000060 38 62 66 36 39 38 39 64 36 34 37 61 62 32 38 38 |8bf6989d647ab288| 00000070 64 31 63 30 39 38 30 36 65 34 61 33 36 61 34 65 |d1c09806e4a36a4e| 00000080 62 62 66 36 2f 30 0a 6c 69 6e 75 78 20 2f 6f 73 |bbf6/0.linux /os| 00000090 74 72 65 65 2f 74 65 73 74 6f 73 2d 61 65 34 36 |tree/testos-ae46| 000000a0 34 39 36 38 30 64 33 65 38 33 62 32 34 65 34 37 |49680d3e83b24e47| 000000b0 66 38 64 66 31 30 38 31 38 62 66 36 39 38 39 64 |f8df10818bf6989d| 000000c0 36 34 37 61 62 32 38 38 64 31 63 30 39 38 30 36 |647ab288d1c09806| 000000d0 65 34 61 33 36 61 34 65 62 62 66 36 2f 76 6d 6c |e4a36a4ebbf6/vml| 000000e0 69 6e 75 7a 2d 33 2e 36 2e 30 0a 74 69 74 6c 65 |inuz-3.6.0.title| 000000f0 20 54 65 73 74 4f 53 20 34 32 20 32 30 31 39 30 | TestOS 42 20190| 00000100 38 32 34 2e 30 20 28 6f 73 74 72 65 65 29 0a |824.0 (ostree).| 0000010f Closes: #1904 Approved by: cgwalters
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* codebase: start using GLNX_HASH_TABLE_FOREACH macrosJonathan Lebon2017-06-281-12/+5
| | | | | | | | | | | Use the new macros introduced recently in libglnx to make iterating over hash tables cleaner. This is just a start, it does not migrate the whole tree. Update submodule: libglnx Closes: #971 Approved by: cgwalters
* lib/boot: Convert bootconfig parser to new code styleColin Walters2017-04-191-31/+15
| | | | | | | This is a small one. Closes: #790 Approved by: jlebon
* tree-wide: Use g_hash_table_add() where applicableColin Walters2016-12-061-1/+1
| | | | | | | | Just noticed a few while reading some code, decided to do a quick cleanup. It's shorter and clearer. Closes: #614 Approved by: jlebon
* [ASAN] bootconfig: Drop a pointless strdup in parserColin Walters2016-11-301-3/+2
| | | | | | | | Not entirely sure how this was leaking, but anyways it showed up in ASAN, and it's pointless to strdup here. Closes: #598 Approved by: jlebon
* lib: Fix compiler warning from previous patchColin Walters2016-07-281-1/+1
| | | | | | | I had this in a `fixup!` I thought. Closes: #414 Approved by: giuseppe
* lib: Fix leak in bootconfig parserColin Walters2016-07-281-1/+1
| | | | | | | Pretty simple. Closes: #410 Approved by: giuseppe
* bootconfig: Add ostree_bootconfig_parser_write_atColin Walters2015-12-191-12/+22
| | | | | This fd-relative API will be used by later libostree porting in the deploy code path.
* Use g_autoptr(GHashTable) instead of gs_unref_hashtableMatthew Barnes2015-05-061-1/+1
|
* Use g_autoptr(GBytes) instead of gs_unref_bytesMatthew Barnes2015-05-061-1/+1
|
* Use g_autofree instead of gs_freeMatthew Barnes2015-05-061-1/+1
|
* sysroot: Read the bootloader configuration with fd-relative APIColin Walters2015-03-091-5/+26
| | | | Another piece of the conversion.
* deploy: fdatasync() bootloader configuration filesColin Walters2014-04-111-39/+22
| | | | Yet more data we're writing out that needs to be sync'd.
* libostree: Add ostree_bootconfig_parser_clone()Colin Walters2014-03-191-0/+24
| | | | | This will be necessary to fix ostree_deployment_clone(), but is potentially useful on its own for other consumers.
* Move Deployment and BootconfigParser into libostreeColin Walters2013-09-151-0/+228
As part of moving admin functionality there. While we are doing this, rename OtConfigParser to OstreeBootConfig parser since it's a better name.