From f37426f1ad7b2e61e57b290ee9ef48116d66e0ff Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 7 Mar 2019 00:42:57 +0000 Subject: [PATCH] compose: Remove support for boot-location: both I'd like to add a new `boot-location: modules`. In prep for that, let's remove the legacy `both` which drops into `/boot`. The libostree support for handling `/usr/lib/ostree-boot` has existed for over 4 years: ``` commit 37a059925f6b96d30190b65bee6bdde0ae1c6915 Commit: Colin Walters CommitDate: Sun Nov 30 23:14:05 2014 -0500 deploy: Ensure that we can deploy using only /usr/lib/ostree-boot ``` I think we assume now that no one is now making *new* treecomposes and needs a newer rpm-ostree and that they expect people to be able to use as an upgrade target from a libostree that predates that. Closes: #1773 Approved by: jlebon --- docs/manual/treefile.md | 10 +++------ rust/src/treefile.rs | 14 +++++------- src/libpriv/rpmostree-postprocess.c | 29 ++----------------------- tests/compose-tests/libbasic-test.sh | 10 ++++----- tests/compose-tests/test-installroot.sh | 4 ---- 5 files changed, 14 insertions(+), 53 deletions(-) diff --git a/docs/manual/treefile.md b/docs/manual/treefile.md index bd48f321df..5cda7a1188 100644 --- a/docs/manual/treefile.md +++ b/docs/manual/treefile.md @@ -26,13 +26,9 @@ It supports the following parameters: * `selinux`: boolean, optional: Defaults to `true`. If `false`, then no SELinux labeling will be performed on the server side. - * `boot-location` (or `boot_location`): string, optional: Historically, ostree - put bootloader data in /boot. However, this has a few flaws; it gets - shadowed at boot time, and also makes dealing with Anaconda installation - harder. There are 3 possible values: - * "both": the default, kernel data goes in /boot and /usr/lib/ostree-boot - * "legacy": Now an alias for "both"; historically meant just "boot" - * "new": kernel data goes in /usr/lib/ostree-boot and /usr/lib/modules + * `boot-location` (or `boot_location`): string, optional: If specified, this value + must be "new". Historically rpm-ostree supported multiple kernel locations; + this is no longer the case. * `etc-group-members`: Array of strings, optional: Unix groups in this list will be stored in `/etc/group` instead of `/usr/lib/group`. Use diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 4da73e96b4..711180754e 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -518,17 +518,13 @@ fn whitespace_split_packages(pkgs: &[String]) -> Vec { #[derive(Serialize, Deserialize, Debug, PartialEq)] enum BootLocation { - #[serde(rename = "both")] - Both, - #[serde(rename = "legacy")] - Legacy, #[serde(rename = "new")] New, } impl Default for BootLocation { fn default() -> Self { - BootLocation::Both + BootLocation::New } } @@ -820,13 +816,13 @@ remove-files: let treefile = append_and_parse( " gpg_key: foo -boot_location: both +boot_location: new default_target: bar automatic_version_prefix: baz ", ); assert!(treefile.gpg_key.unwrap() == "foo"); - assert!(treefile.boot_location.unwrap() == BootLocation::Both); + assert!(treefile.boot_location.unwrap() == BootLocation::New); assert!(treefile.default_target.unwrap() == "bar"); assert!(treefile.automatic_version_prefix.unwrap() == "baz"); } @@ -836,13 +832,13 @@ automatic_version_prefix: baz let treefile = append_and_parse( " gpg-key: foo -boot-location: both +boot-location: new default-target: bar automatic-version-prefix: baz ", ); assert!(treefile.gpg_key.unwrap() == "foo"); - assert!(treefile.boot_location.unwrap() == BootLocation::Both); + assert!(treefile.boot_location.unwrap() == BootLocation::New); assert!(treefile.default_target.unwrap() == "bar"); assert!(treefile.automatic_version_prefix.unwrap() == "baz"); } diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c index 2d018b4f5d..88d97087ae 100644 --- a/src/libpriv/rpmostree-postprocess.c +++ b/src/libpriv/rpmostree-postprocess.c @@ -50,7 +50,6 @@ #include "rpmostree-rust.h" typedef enum { - RPMOSTREE_POSTPROCESS_BOOT_LOCATION_BOTH, RPMOSTREE_POSTPROCESS_BOOT_LOCATION_NEW } RpmOstreePostprocessBootLocation; @@ -356,7 +355,7 @@ process_kernel_and_initramfs (int rootfs_dfd, return FALSE; RpmOstreePostprocessBootLocation boot_location = - RPMOSTREE_POSTPROCESS_BOOT_LOCATION_BOTH; + RPMOSTREE_POSTPROCESS_BOOT_LOCATION_NEW; const char *boot_location_str = NULL; if (!_rpmostree_jsonutil_object_get_optional_string_member (treefile, "boot-location", @@ -364,13 +363,7 @@ process_kernel_and_initramfs (int rootfs_dfd, return FALSE; if (boot_location_str != NULL) { - /* Make "legacy" an alias for "both" */ - if (strcmp (boot_location_str, "both") == 0 || - strcmp (boot_location_str, "legacy") == 0) - ; - else if (strcmp (boot_location_str, "new") == 0) - boot_location = RPMOSTREE_POSTPROCESS_BOOT_LOCATION_NEW; - else + if (!g_str_equal (boot_location_str, "new")) return glnx_throw (error, "Invalid boot location '%s'", boot_location_str); } @@ -456,24 +449,6 @@ process_kernel_and_initramfs (int rootfs_dfd, if (!glnx_ensure_dir (rootfs_dfd, "boot", 0755, error)) return FALSE; - /* If the boot location includes /boot, we also need to copy /usr/lib/ostree-boot there */ - switch (boot_location) - { - case RPMOSTREE_POSTPROCESS_BOOT_LOCATION_BOTH: - { - g_print ("Using boot location: both\n"); - /* Hardlink the existing content, only a little ugly as - * we'll end up sha256'ing it twice, but oh well. */ - if (!hardlink_recurse (rootfs_dfd, "usr/lib/ostree-boot", - rootfs_dfd, "boot", - cancellable, error)) - return glnx_prefix_error (error, "hardlinking /boot"); - } - break; - case RPMOSTREE_POSTPROCESS_BOOT_LOCATION_NEW: - break; - } - return TRUE; } diff --git a/tests/compose-tests/libbasic-test.sh b/tests/compose-tests/libbasic-test.sh index cc7cfcad7c..2c7ebf93df 100644 --- a/tests/compose-tests/libbasic-test.sh +++ b/tests/compose-tests/libbasic-test.sh @@ -48,12 +48,10 @@ ostree --repo=${repobuild} show --print-metadata-key rpmostree.rpmmd-repos ${tre assert_file_has_content meta.txt 'id.*fedora.*timestamp' echo "ok metadata" -for path in /boot /usr/lib/ostree-boot; do - ostree --repo=${repobuild} ls -R ${treeref} ${path} > bootls.txt - assert_file_has_content bootls.txt vmlinuz- - assert_file_has_content bootls.txt initramfs- - echo "ok boot files" -done +ostree --repo=${repobuild} ls -R ${treeref} /usr/lib/ostree-boot > bootls.txt +assert_file_has_content bootls.txt vmlinuz- +assert_file_has_content bootls.txt initramfs- +echo "ok boot files" vmlinuz_line=$(grep -o '/vmlinuz.*$' bootls.txt) kver=$(echo ${vmlinuz_line} | sed -e 's,^/vmlinuz-,,' -e 's,-[0-9a-f]*$,,') ostree --repo=${repobuild} ls ${treeref} /usr/lib/modules/${kver}/vmlinuz >/dev/null diff --git a/tests/compose-tests/test-installroot.sh b/tests/compose-tests/test-installroot.sh index cc2652bb57..9fd9fba666 100755 --- a/tests/compose-tests/test-installroot.sh +++ b/tests/compose-tests/test-installroot.sh @@ -26,10 +26,6 @@ integrationconf=usr/lib/tmpfiles.d/rpm-ostree-0-integration.conf assert_not_has_file ${instroot}-postprocess/${integrationconf} rpm-ostree compose postprocess ${instroot}-postprocess assert_has_file ${instroot}-postprocess/${integrationconf} -# Without treefile, kernels end up in "both" mode -ls ${instroot}-postprocess/boot > ls.txt -assert_file_has_content ls.txt '^vmlinuz-' -rm -f ls.txt ostree --repo=${repobuild} commit -b test-directcommit --selinux-policy ${instroot}-postprocess --tree=dir=${instroot}-postprocess echo "ok postprocess + direct commit"