Skip to content

Commit

Permalink
compose: Remove support for boot-location: both
Browse files Browse the repository at this point in the history
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 37a0599
Commit:     Colin Walters <walters@verbum.org>
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
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Mar 8, 2019
1 parent 6b928e8 commit f37426f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 53 deletions.
10 changes: 3 additions & 7 deletions docs/manual/treefile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions rust/src/treefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,17 +518,13 @@ fn whitespace_split_packages(pkgs: &[String]) -> Vec<String> {

#[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
}
}

Expand Down Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down
29 changes: 2 additions & 27 deletions src/libpriv/rpmostree-postprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "rpmostree-rust.h"

typedef enum {
RPMOSTREE_POSTPROCESS_BOOT_LOCATION_BOTH,
RPMOSTREE_POSTPROCESS_BOOT_LOCATION_NEW
} RpmOstreePostprocessBootLocation;

Expand Down Expand Up @@ -356,21 +355,15 @@ 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",
&boot_location_str, error))
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);
}

Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 4 additions & 6 deletions tests/compose-tests/libbasic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/compose-tests/test-installroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit f37426f

Please sign in to comment.