From 8c38641042e274a713a18daf7fc85584ca0fc9bb Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 12 Jun 2023 13:02:37 +0100 Subject: [PATCH 7/9] src: Fix --if-newer --copy-kernel We previously copied the kernel into the appliance using 'cp -p' which preserves the datestamps of the installed kernel. This can confuse the --if-newer calculation, if for example the package database is newer than the date on the installed kernel (which quite often is the case). This makes it think that the appliance is always older than the package database, thus forcing a rebuild. We can fix this using 'cp' instead of 'cp -p'. We don't need the permissions and datestamps on the copied kernel to be preserved anyway (in fact, it could cause problems if the permissions are restrictive). Fixes: commit 30de2cb603cdde33524a66d5466f6a9b986ce8a6 --- src/format_ext2_kernel.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml index c592703..6d2e699 100644 --- a/src/format_ext2_kernel.ml +++ b/src/format_ext2_kernel.ml @@ -311,6 +311,9 @@ and copy_or_symlink_file copy_kernel src dest = if not copy_kernel then symlink src dest else ( - let cmd = sprintf "cp -p %s %s" (quote src) (quote dest) in + (* NB: Do not use -p here, we want the kernel to appear newer + * so that --if-newer works. + *) + let cmd = sprintf "cp %s %s" (quote src) (quote dest) in run_command cmd ) -- 2.37.3