summaryrefslogtreecommitdiffstats
path: root/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch')
-rw-r--r--recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch b/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
new file mode 100644
index 0000000..ffcc77c
--- /dev/null
+++ b/recipes/ostree/ostree/Allow-updating-files-in-the-boot-directory.patch
@@ -0,0 +1,99 @@
1From 7f4549c6e94494460be06311c3a4d23ae684ab21 Mon Sep 17 00:00:00 2001
2From: Gatis Paeglis <gatis.paeglis@theqtcompany.com>
3Date: Wed, 20 Apr 2016 13:58:27 +0200
4Subject: [PATCH 1/3] Allow updating files in the /boot directory.
5
6Until now OSTree copied only the vmlinuz and initramfs
7binaries to the boot/ directory (which in some setups
8might be on a separate partition). This patch adds
9support for copying other files from the deployment's
10/boot directory to the real /boot.
11
12How this works:
13
14Ignore subdirectories, only files in root of the boot
15directory are copied. There is overhead of copying files
16to boot/, therefore the amount of files in boot/ should
17be kept to the minimum and subdirectories shouldn't
18really be necessary.
19
20Files in the boot/ directory are updated only with major
21releases, when kernel/initramfs bootcsum changes. Files
22that require frequent updates should not be stored here.
23---
24 src/libostree/ostree-sysroot-deploy.c | 52 +++++++++++++++++++++++++++++++++++
25 1 file changed, 52 insertions(+)
26
27diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
28index 8877236..8cf080e 100644
29--- a/src/libostree/ostree-sysroot-deploy.c
30+++ b/src/libostree/ostree-sysroot-deploy.c
31@@ -1295,6 +1295,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
32 g_autofree char *version_key = NULL;
33 g_autofree char *ostree_kernel_arg = NULL;
34 g_autofree char *options_key = NULL;
35+ g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
36 GString *title_key;
37 __attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
38 const char *val;
39@@ -1361,6 +1362,57 @@ install_deployment_kernel (OstreeSysroot *sysroot,
40 }
41 }
42
43+
44+ /* Copy other files that are stored in deployment's /usr/lib/ostree-boot. Lets keep this simple:
45+ *
46+ * - Ignore subdirectories. Only files in root of the /usr/lib/ostree-boot directory are copied.
47+ * There is an overhead of copying files to boot/, therefore the amount of files in a deployment's
48+ * usr/lib/ostree-boot should be kept to the minimum and subdirectories shouldn't really
49+ * be necessary.
50+ *
51+ * - Files in /boot are updated only with major releases, when kernel/initramfs
52+ * bootcsum changes. Files that require frequent updates should not be stored here.
53+ */
54+ if (!glnx_dirfd_iterator_init_take_fd (dup (tree_boot_dfd), &dfd_iter, error))
55+ goto out;
56+
57+ while (TRUE)
58+ {
59+ struct dirent *dent;
60+
61+ if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
62+ goto out;
63+
64+ if (dent == NULL)
65+ break;
66+
67+ if (fstatat (dfd_iter.fd, dent->d_name, &stbuf, 0) != 0)
68+ {
69+ if (errno == ENOENT)
70+ continue;
71+ glnx_set_error_from_errno (error);
72+ goto out;
73+ }
74+
75+ if (g_str_has_prefix (dent->d_name, "vmlinuz-") || g_str_has_prefix (dent->d_name, "initramfs-")
76+ || !S_ISREG(stbuf.st_mode))
77+ continue;
78+
79+ if (fstatat (bootcsum_dfd, dent->d_name, &stbuf, 0) != 0)
80+ {
81+ if (errno != ENOENT)
82+ {
83+ glnx_set_prefix_error_from_errno (error, "fstat %s", dent->d_name);
84+ goto out;
85+ }
86+ if (!glnx_file_copy_at (tree_boot_dfd, dent->d_name, &stbuf,
87+ bootcsum_dfd, dent->d_name, 0,
88+ cancellable, error))
89+ goto out;
90+ }
91+ }
92+
93+
94 if (fstatat (deployment_dfd, "usr/lib/os-release", &stbuf, 0) != 0)
95 {
96 if (errno != ENOENT)
97--
982.7.4
99