summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-os.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-03-11 01:36:13 +0000
committerColin Walters <walters@verbum.org>2021-03-12 19:01:42 +0000
commit857587615dc36d2d99e1a9bd36486f4267298971 (patch)
treedaa91a2fa072e7a184f8ddf73d0ed86a30db44d0 /src/libostree/ostree-repo-os.h
parent31e19935b509d65c835639b9eaf4ac553aa61655 (diff)
downloadostree-857587615dc36d2d99e1a9bd36486f4267298971.tar.gz
Add an API+CLI to inject metadata for bootable OSTree commits
I was doing some rpm-ostree work and I wanted to compare two OSTree commits to see if the kernel has changed. I think this should be a lot more natural. Add `ostree commit --bootable` which calls into a new generic library API `ostree_commit_metadata_for_bootable()` that discovers the kernel version and injects it as an `ostree.linux` metadata key. And for extra clarity, add an `ostree.bootable` key. It's interesting because the "core" OSTree layer is all about generic files, but this is adding special APIs around bootable OSTree commits (as opposed to e.g. flatpak as well as things like rpm-ostree's pkgcache refs). Eventually, I'd like to ensure everyone is using this and hard require this metadata key for the `ostree admin deploy` flow - mainly to prevent accidents.
Diffstat (limited to 'src/libostree/ostree-repo-os.h')
-rw-r--r--src/libostree/ostree-repo-os.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-os.h b/src/libostree/ostree-repo-os.h
new file mode 100644
index 00000000..b2443768
--- /dev/null
+++ b/src/libostree/ostree-repo-os.h
@@ -0,0 +1,47 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.0+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <sys/stat.h>
+#include <gio/gio.h>
+#include <ostree-types.h>
+
+G_BEGIN_DECLS
+
+/**
+ * OSTREE_METADATA_KEY_BOOTABLE:
+ *
+ * GVariant type `b`: Set if this commit is intended to be bootable
+ * Since: 2021.1
+ */
+#define OSTREE_METADATA_KEY_BOOTABLE "ostree.bootable"
+/**
+ * OSTREE_METADATA_KEY_LINUX:
+ *
+ * GVariant type `s`: Contains the Linux kernel release (i.e. `uname -r`)
+ * Since: 2021.1
+ */
+#define OSTREE_METADATA_KEY_LINUX "ostree.linux"
+
+_OSTREE_PUBLIC
+gboolean
+ostree_commit_metadata_for_bootable (GFile *root, GVariantDict *dict, GCancellable *cancellable, GError **error);
+
+G_END_DECLS