From 2fb7a048384b02755d078d8a385a33ca341865d0 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 28 Feb 2024 09:40:34 -0500 Subject: [PATCH] sysroot: Turn on bootloader-naming-2 by default I think it's about time we flipped this on by default; like the bootprefix I was a bit too chicken. We still have a `bootloader-naming-1` that can be flipped on in case of some regression. Closes: https://github.com/ostreedev/ostree/issues/2961 --- src/libostree/ostree-sysroot-deploy.c | 40 +++++++++++++++------- src/libostree/ostree-sysroot-private.h | 2 +- src/libostree/ostree-sysroot.c | 2 +- tests/admin-test.sh | 46 +++++++++++++------------- tests/inst/src/destructive.rs | 2 +- tests/test-admin-deploy-2.sh | 4 +-- tests/test-admin-deploy-bootprefix.sh | 4 +-- tests/test-admin-deploy-karg.sh | 28 ++++++++-------- tests/test-admin-deploy-nomerge.sh | 6 ++-- tests/test-admin-deploy-none.sh | 2 +- tests/test-admin-deploy-syslinux.sh | 6 ++-- tests/test-admin-instutil-set-kargs.sh | 22 ++++++------ tests/test-admin-kargs.sh | 6 ++-- tests/test-admin-pull-deploy-split.sh | 4 +-- tests/test-admin-upgrade-endoflife.sh | 2 +- tests/test-no-initramfs.sh | 26 +++++++-------- 16 files changed, 109 insertions(+), 93 deletions(-) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index df1254df7e..5d2d729bf0 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1853,6 +1853,30 @@ parse_os_release (const char *contents, const char *split) return ret; } +/* Generate the filename we will use in /boot/loader/entries for this deployment. + * The provided n_deployments should be the total number of target deployments (which + * might be different from the cached value in the sysroot). + */ +static char * +bootloader_entry_filename (OstreeSysroot *sysroot, guint n_deployments, + OstreeDeployment *deployment) +{ + guint index = n_deployments - ostree_deployment_get_index (deployment); + // Allow opt-out to dropping the stateroot in case of compatibility issues. + // As of 2024.5, we have a new naming scheme because grub2 parses the *filename* and ignores + // the version field. xref https://github.com/ostreedev/ostree/issues/2961 + bool use_old_naming = (sysroot->opt_flags & OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_1) > 0; + if (use_old_naming) + { + const char *stateroot = ostree_deployment_get_osname (deployment); + return g_strdup_printf ("ostree-%d-%s.conf", index, stateroot); + } + else + { + return g_strdup_printf ("ostree-%d.conf", index); + } +} + /* Given @deployment, prepare it to be booted; basically copying its * kernel/initramfs into /boot/ostree (if needed) and writing out an entry in * /boot/loader/entries. @@ -1887,15 +1911,8 @@ install_deployment_kernel (OstreeSysroot *sysroot, int new_bootversion, const char *bootcsum = ostree_deployment_get_bootcsum (deployment); g_autofree char *bootcsumdir = g_strdup_printf ("ostree/%s-%s", osname, bootcsum); g_autofree char *bootconfdir = g_strdup_printf ("loader.%d/entries", new_bootversion); - g_autofree char *bootconf_name = NULL; - guint index = n_deployments - ostree_deployment_get_index (deployment); - // Allow opt-in to dropping the stateroot, because grub2 parses the *filename* and ignores - // the version field. xref https://github.com/ostreedev/ostree/issues/2961 - bool use_new_naming = (sysroot->opt_flags & OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_2) > 0; - if (use_new_naming) - bootconf_name = g_strdup_printf ("ostree-%d.conf", index); - else - bootconf_name = g_strdup_printf ("ostree-%d-%s.conf", index, osname); + g_autofree char *bootconf_name = bootloader_entry_filename (sysroot, n_deployments, deployment); + if (!glnx_shutil_mkdir_p_at (sysroot->boot_fd, bootcsumdir, 0775, cancellable, error)) return FALSE; @@ -4221,9 +4238,8 @@ ostree_sysroot_deployment_set_kargs_in_place (OstreeSysroot *self, OstreeDeploym OstreeBootconfigParser *new_bootconfig = ostree_deployment_get_bootconfig (deployment); ostree_bootconfig_parser_set (new_bootconfig, "options", kargs_str); - g_autofree char *bootconf_name = g_strdup_printf ( - "ostree-%d-%s.conf", self->deployments->len - ostree_deployment_get_index (deployment), - ostree_deployment_get_osname (deployment)); + g_autofree char *bootconf_name + = bootloader_entry_filename (self, self->deployments->len, deployment); g_autofree char *bootconfdir = g_strdup_printf ("loader.%d/entries", self->bootversion); glnx_autofd int bootconf_dfd = -1; diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index 297b3273a0..41513acc30 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -45,7 +45,7 @@ typedef enum OSTREE_SYSROOT_GLOBAL_OPT_SKIP_SYNC = 1 << 0, /* See https://github.com/ostreedev/ostree/pull/2847 */ OSTREE_SYSROOT_GLOBAL_OPT_NO_EARLY_PRUNE = 1 << 1, - OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_2 = 1 << 2, + OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_1 = 1 << 2, } OstreeSysrootGlobalOptFlags; typedef enum diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 5b4617faa0..a25d0b20e1 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -181,7 +181,7 @@ ostree_sysroot_init (OstreeSysroot *self) const GDebugKey globalopt_keys[] = { { "skip-sync", OSTREE_SYSROOT_GLOBAL_OPT_SKIP_SYNC }, { "no-early-prune", OSTREE_SYSROOT_GLOBAL_OPT_NO_EARLY_PRUNE }, - { "bootloader-naming-2", OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_2 }, + { "bootloader-naming-1", OSTREE_SYSROOT_GLOBAL_OPT_BOOTLOADER_NAMING_1 }, }; const GDebugKey keys[] = { { "mutable-deployments", OSTREE_SYSROOT_DEBUG_MUTABLE_DEPLOYMENTS }, diff --git a/tests/admin-test.sh b/tests/admin-test.sh index 0179067593..3417d01adb 100644 --- a/tests/admin-test.sh +++ b/tests/admin-test.sh @@ -92,9 +92,9 @@ echo "ok nice error for deploy with no stateroot" assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 assert_has_dir sysroot/ostree/boot.1.1 -assert_has_file sysroot/boot/loader/entries/ostree-1-testos.conf -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* quiet' +assert_has_file sysroot/boot/loader/entries/ostree-1.conf +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* quiet' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/etc/os-release 'NAME=TestOS' assert_file_has_content sysroot/ostree/boot.1/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS' @@ -120,7 +120,7 @@ assert_not_has_dir sysroot/ostree/boot.0.0 assert_not_has_dir sysroot/ostree/boot.1.0 assert_not_has_dir sysroot/ostree/boot.1.1 # Ensure we propagated kernel arguments from previous deployment -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.* root=LABEL=MOO' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS' assert_file_has_content sysroot/ostree/boot.0/testos/${bootcsum}/0/etc/os-release 'NAME=TestOS' assert_ostree_deployment_refs 0/1/{0,1} @@ -147,8 +147,8 @@ ${CMD_PREFIX} ostree admin os-init otheros ${CMD_PREFIX} ostree admin deploy --os=otheros testos/buildmain/x86_64-runtime assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf -assert_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf +assert_has_file sysroot/boot/loader/entries/ostree-2.conf +assert_has_file sysroot/boot/loader/entries/ostree-3.conf assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.1/etc/os-release 'NAME=TestOS' assert_file_has_content sysroot/ostree/deploy/otheros/deploy/${rev}.0/etc/os-release 'NAME=TestOS' assert_ostree_deployment_refs 1/1/{0,1,2} @@ -160,9 +160,9 @@ echo "ok independent deploy" ${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/loader.0 assert_not_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-4-testos.conf +assert_has_file sysroot/boot/loader/entries/ostree-4.conf assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.2/etc/os-release 'NAME=TestOS' -assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf +assert_has_file sysroot/boot/loader/entries/ostree-2.conf assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS' ${CMD_PREFIX} ostree admin status assert_ostree_deployment_refs 0/1/{0,1,2,3} @@ -202,14 +202,14 @@ echo "ok undeploy error invalid int" for i in $(seq 4); do ${CMD_PREFIX} ostree admin undeploy 0 done -assert_has_file sysroot/boot/loader/entries/ostree-1-testos.conf -assert_not_has_file sysroot/boot/loader/entries/ostree-2-testos.conf -assert_not_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf +assert_has_file sysroot/boot/loader/entries/ostree-1.conf +assert_not_has_file sysroot/boot/loader/entries/ostree-2.conf +assert_not_has_file sysroot/boot/loader/entries/ostree-3.conf ${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmain/x86_64-runtime assert_has_dir sysroot/boot/loader.0 assert_not_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf -assert_has_file sysroot/boot/loader/entries/ostree-1-otheros.conf +assert_has_file sysroot/boot/loader/entries/ostree-2.conf +assert_has_file sysroot/boot/loader/entries/ostree-1.conf ${CMD_PREFIX} ostree admin status validate_bootloader @@ -218,9 +218,9 @@ echo "ok deploy --not-as-default" ${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmain/x86_64-runtime assert_not_has_dir sysroot/boot/loader.0 assert_has_dir sysroot/boot/loader.1 -assert_has_file sysroot/boot/loader/entries/ostree-3-otheros.conf -assert_has_file sysroot/boot/loader/entries/ostree-2-testos.conf -assert_has_file sysroot/boot/loader/entries/ostree-1-otheros.conf +assert_has_file sysroot/boot/loader/entries/ostree-3.conf +assert_has_file sysroot/boot/loader/entries/ostree-2.conf +assert_has_file sysroot/boot/loader/entries/ostree-1.conf ${CMD_PREFIX} ostree admin status validate_bootloader @@ -228,11 +228,11 @@ echo "ok deploy --retain-rollback" ${CMD_PREFIX} ostree admin status -assert_file_has_content sysroot/boot/loader/entries/ostree-3-otheros.conf "^title.*TestOS 42 1.0.10" +assert_file_has_content sysroot/boot/loader/entries/ostree-3.conf "^title.*TestOS 42 1.0.10" ${CMD_PREFIX} ostree admin set-default 1 -assert_file_has_content sysroot/boot/loader/entries/ostree-3-testos.conf "^title.*TestOS 42 1.0.10" +assert_file_has_content sysroot/boot/loader/entries/ostree-3.conf "^title.*TestOS 42 1.0.10" ${CMD_PREFIX} ostree admin set-default 1 -assert_file_has_content sysroot/boot/loader/entries/ostree-3-otheros.conf "^title.*TestOS 42 1.0.10" +assert_file_has_content sysroot/boot/loader/entries/ostree-3.conf "^title.*TestOS 42 1.0.10" echo "ok set-default" @@ -305,7 +305,7 @@ echo "ok deploy with unknown OS" ${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=console=/dev/foo --karg-append=console=/dev/bar testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar' +assert_file_has_content sysroot/boot/loader/entries/ostree-4.conf 'console=/dev/foo.*console=/dev/bar' validate_bootloader echo "ok deploy with multiple kernel args" @@ -315,17 +315,17 @@ os_repository_new_commit 0 "test upgrade multiple kernel args" ${CMD_PREFIX} ostree admin upgrade --os=testos newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) assert_not_streq ${origrev} ${newrev} -assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf 'console=/dev/foo.*console=/dev/bar' +assert_file_has_content sysroot/boot/loader/entries/ostree-4.conf 'console=/dev/foo.*console=/dev/bar' validate_bootloader echo "ok upgrade with multiple kernel args" os_repository_new_commit ${CMD_PREFIX} ostree admin upgrade --os=testos -assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 ${version} (ostree:testos:0)$" +assert_file_has_content sysroot/boot/loader/entries/ostree-4.conf "^title TestOS 42 ${version} (ostree:testos:0)$" os_repository_new_commit 0 0 testos/buildmain/x86_64-runtime 42 ${CMD_PREFIX} ostree admin upgrade --os=testos -assert_file_has_content sysroot/boot/loader/entries/ostree-4-testos.conf "^title TestOS 42 (ostree:testos:0)$" +assert_file_has_content sysroot/boot/loader/entries/ostree-4.conf "^title TestOS 42 (ostree:testos:0)$" echo "ok no duplicate version strings in title" diff --git a/tests/inst/src/destructive.rs b/tests/inst/src/destructive.rs index aad92714a1..5a89bd0d4e 100644 --- a/tests/inst/src/destructive.rs +++ b/tests/inst/src/destructive.rs @@ -563,7 +563,7 @@ fn suppress_ostree_global_sync(sh: &xshell::Shell) -> Result<()> { // Aslo opt-in to the new bootloader naming std::fs::write( Path::new(dropindir).join("50-test-options.conf"), - "[Service]\nEnvironment=OSTREE_SYSROOT_OPTS=skip-sync,bootloader-naming-2\n", + "[Service]\nEnvironment=OSTREE_SYSROOT_OPTS=skip-sync\n", )?; cmd!(sh, "systemctl daemon-reload").run()?; Ok(()) diff --git a/tests/test-admin-deploy-2.sh b/tests/test-admin-deploy-2.sh index 23645ded6e..97cd0fd64d 100755 --- a/tests/test-admin-deploy-2.sh +++ b/tests/test-admin-deploy-2.sh @@ -69,9 +69,9 @@ oldversion=${version} # another commit with *same* bootcsum but *new* content os_repository_new_commit "1" "2" newversion=${version} -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf ${oldversion} +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf ${oldversion} ${CMD_PREFIX} ostree admin upgrade --os=testos -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf ${newversion} +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf ${newversion} echo "ok new version same bootcsum" diff --git a/tests/test-admin-deploy-bootprefix.sh b/tests/test-admin-deploy-bootprefix.sh index d80c310b3e..712855dae9 100755 --- a/tests/test-admin-deploy-bootprefix.sh +++ b/tests/test-admin-deploy-bootprefix.sh @@ -27,8 +27,8 @@ setup_os_repository "archive" "syslinux" ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootprefix 'true' ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=root --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1-testos.conf 'linux /boot/ostree/testos-' -assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1-testos.conf 'initrd /boot/ostree/testos-' +assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1.conf 'linux /boot/ostree/testos-' +assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1.conf 'initrd /boot/ostree/testos-' tap_ok "bootprefix" diff --git a/tests/test-admin-deploy-karg.sh b/tests/test-admin-deploy-karg.sh index 39fcdf3614..b47bc07168 100755 --- a/tests/test-admin-deploy-karg.sh +++ b/tests/test-admin-deploy-karg.sh @@ -33,12 +33,12 @@ export rev ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin deploy --karg=FOO=BAR --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin deploy --karg=TESTARG=TESTVALUE --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*TESTARG=TESTVALUE' ${CMD_PREFIX} ostree admin deploy --karg=ANOTHERARG=ANOTHERVALUE --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*ANOTHERARG=ANOTHERVALUE' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*TESTARG=TESTVALUE' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*ANOTHERARG=ANOTHERVALUE' echo "ok deploy with --karg, but same config" @@ -49,7 +49,7 @@ for arg in $(cat /proc/cmdline); do ;; initrd=*|BOOT_IMAGE=*) # Skip options set by bootloader that gets filtered out ;; - *) assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf "options.*$arg" + *) assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf "options.*$arg" ;; esac done @@ -60,20 +60,20 @@ ${CMD_PREFIX} ostree admin status ${CMD_PREFIX} ostree admin undeploy 0 ${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=APPENDARG=VALAPPEND --karg-append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*TESTARG=TESTVALUE' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' # Check correct ordering of different-valued args of the same key. ${CMD_PREFIX} ostree admin deploy --os=testos --karg-append=FOO=TESTORDERED --karg-append=APPENDARG=3RDAPPEND testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND .*FOO=TESTORDERED .*APPENDARG=3RDAPPEND' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND .*FOO=TESTORDERED .*APPENDARG=3RDAPPEND' echo "ok deploy --karg-append" -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet .*TESTARG=TESTVALUE .*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*quiet .*TESTARG=TESTVALUE .*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' ${CMD_PREFIX} ostree admin deploy --os=testos --karg-delete=TESTARG=TESTVALUE --karg-delete=quiet --karg-delete=APPENDARG=VALAPPEND testos:testos/buildmain/x86_64-runtime -assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*TESTARG=TESTVALUE' -assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*quiet' -assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'options.*APPENDARG=VALAPPEND' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*TESTARG=TESTVALUE' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*quiet' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'options.*APPENDARG=VALAPPEND' echo "ok deploy --karg-delete" diff --git a/tests/test-admin-deploy-nomerge.sh b/tests/test-admin-deploy-nomerge.sh index 9016f2d548..bac5ee4699 100755 --- a/tests/test-admin-deploy-nomerge.sh +++ b/tests/test-admin-deploy-nomerge.sh @@ -30,11 +30,11 @@ ${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=LABEL=foo --karg=testk origdeployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir) testconfig=etc/modified-config-file-that-will-be-removed touch "${origdeployment}"/"${testconfig}" -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "^options.*root=LABEL=foo.*testkarg" +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf "^options.*root=LABEL=foo.*testkarg" ${CMD_PREFIX} ostree admin deploy --os=testos --no-merge --karg=root=LABEL=bar testos:testos/buildmain/x86_64-runtime deployment=$(${CMD_PREFIX} ostree admin --sysroot=sysroot --print-current-dir) assert_not_streq "${origdeployment}" "${deployment}" assert_not_has_file "${deployment}/${testconfig}" -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "^options root=LABEL=bar" -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "^options .*testkarg" +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf "^options root=LABEL=bar" +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf "^options .*testkarg" echo "ok no merge deployment" diff --git a/tests/test-admin-deploy-none.sh b/tests/test-admin-deploy-none.sh index 22a7700135..ad79e253fb 100755 --- a/tests/test-admin-deploy-none.sh +++ b/tests/test-admin-deploy-none.sh @@ -39,7 +39,7 @@ mkdir -p sysroot/boot/grub2 touch sysroot/boot/grub2/grub.cfg ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos testos/buildmain/x86_64-runtime > out.txt assert_file_has_content out.txt "Bootloader updated.*" -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/.vmlinuz-3.6.0.hmac 'an hmac file' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' diff --git a/tests/test-admin-deploy-syslinux.sh b/tests/test-admin-deploy-syslinux.sh index d2cb504518..3db219893c 100755 --- a/tests/test-admin-deploy-syslinux.sh +++ b/tests/test-admin-deploy-syslinux.sh @@ -36,8 +36,8 @@ for test_bootdir in "boot" "usr/lib/ostree-boot"; do ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime - assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' - assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* quiet' + assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO' + assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* quiet' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' # kernel/initrams should also be in the tree's /boot with the checksum @@ -62,7 +62,7 @@ cd ${test_tmpdir} ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' # Note this bootcsum shouldn't be the modules one diff --git a/tests/test-admin-instutil-set-kargs.sh b/tests/test-admin-instutil-set-kargs.sh index a1aabef5c5..27fd1ebc18 100755 --- a/tests/test-admin-instutil-set-kargs.sh +++ b/tests/test-admin-instutil-set-kargs.sh @@ -32,25 +32,25 @@ ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-run ${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAR ${CMD_PREFIX} ostree admin instutil set-kargs FOO=BAZ FOO=BIF TESTARG=TESTVALUE KEYWORD EMPTYLIST= -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAZ .*FOO=BIF' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=BAZ .*FOO=BIF' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' echo "ok instutil set-kargs (basic)" ${CMD_PREFIX} ostree admin instutil set-kargs --merge FOO=BAR -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAZ .*FOO=BIF .*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=BAZ .*FOO=BIF .*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' echo "ok instutil set-kargs --merge" ${CMD_PREFIX} ostree admin instutil set-kargs --merge --replace=FOO=XXX -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=XXX' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=XXX' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*TESTARG=TESTVALUE KEYWORD EMPTYLIST=' echo "ok instutil set-kargs --replace" ${CMD_PREFIX} ostree admin instutil set-kargs --merge --append=FOO=BAR --append=APPENDARG=VALAPPEND --append=APPENDARG=2NDAPPEND testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*FOO=XXX.*FOO=BAR' -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*FOO=XXX.*FOO=BAR' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*APPENDARG=VALAPPEND .*APPENDARG=2NDAPPEND' echo "ok instutil set-kargs --append" ${CMD_PREFIX} ostree admin instutil set-kargs --import-proc-cmdline @@ -60,7 +60,7 @@ for arg in $(cat /proc/cmdline); do ;; initrd=*|BOOT_IMAGE=*) # Skip options set by bootloader that gets filtered out ;; - *) assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf "options.*$arg" + *) assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf "options.*$arg" ;; esac done diff --git a/tests/test-admin-kargs.sh b/tests/test-admin-kargs.sh index afcfc05a04..8211c256e9 100755 --- a/tests/test-admin-kargs.sh +++ b/tests/test-admin-kargs.sh @@ -31,14 +31,14 @@ ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testo ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin kargs edit-in-place --append-if-missing=TESTARG=TESTVALUE --append-if-missing=ARGWITHOUTKEY testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.*TESTARG=TESTVALUE .*ARGWITHOUTKEY' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'options.*TESTARG=TESTVALUE .*ARGWITHOUTKEY' echo "ok kargs edit-in-place (basic)" ${CMD_PREFIX} ostree admin kargs edit-in-place --append-if-missing=quiet testos:testos/buildmain/x86_64-runtime -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'quiet$' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'quiet$' ${CMD_PREFIX} ostree admin kargs edit-in-place --append-if-missing=TESTARG=TESTVALUE testos:testos/buildmain/x86_64-runtime -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TESTARG=TESTVALUE$' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'TESTARG=TESTVALUE$' echo "ok kargs edit-in-place (duplicate)" diff --git a/tests/test-admin-pull-deploy-split.sh b/tests/test-admin-pull-deploy-split.sh index 52bec63a25..ebe303837f 100755 --- a/tests/test-admin-pull-deploy-split.sh +++ b/tests/test-admin-pull-deploy-split.sh @@ -44,13 +44,13 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --pull-only --os=testos > out.txt assert_not_file_has_content out.txt 'No update available' assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 assert_not_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'TestOS 42 1\.0\.9' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'TestOS 42 1\.0\.9' assert_streq "${rev}" $(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmain/x86_64-runtime) # Now, generate new content upstream; we shouldn't pull it os_repository_new_commit ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt assert_not_file_has_content out.txt 'No update available' -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'TestOS 42 1\.0\.10' +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'TestOS 42 1\.0\.10' assert_has_dir sysroot/ostree/deploy/testos/deploy/${parent_rev}.0 assert_has_dir sysroot/ostree/deploy/testos/deploy/${rev}.0 ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only --os=testos > out.txt diff --git a/tests/test-admin-upgrade-endoflife.sh b/tests/test-admin-upgrade-endoflife.sh index ecac228f13..5336ea1492 100755 --- a/tests/test-admin-upgrade-endoflife.sh +++ b/tests/test-admin-upgrade-endoflife.sh @@ -63,7 +63,7 @@ ${CMD_PREFIX} ostree admin upgrade --os=testos --pull-only ${CMD_PREFIX} ostree admin upgrade --os=testos --deploy-only # Check we got redirected to the new branch -assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf "${bootcsum}" +assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf "${bootcsum}" rev=$(${CMD_PREFIX} ostree --repo=${test_tmpdir}/testos-repo rev-parse testos/buildmain/newbranch) assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.0/usr/bin/content-iteration "1" diff --git a/tests/test-no-initramfs.sh b/tests/test-no-initramfs.sh index 84c44576d5..bd25b68811 100755 --- a/tests/test-no-initramfs.sh +++ b/tests/test-no-initramfs.sh @@ -12,8 +12,8 @@ ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=fals ${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmain/x86_64-runtime ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=rootfs --os=testos testos:testos/buildmain/x86_64-runtime -assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'root=LABEL=rootfs' -assert_not_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'init=' +assert_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'root=LABEL=rootfs' +assert_not_file_has_content sysroot/boot/loader/entries/ostree-1.conf 'init=' echo "ok deployment with initramfs" @@ -63,28 +63,28 @@ for layout in /usr/lib/modules /usr/lib/ostree-boot /boot; do pull_test_tree "the kernel only" ${CMD_PREFIX} ostree admin deploy --os=testos --karg=root=/dev/sda2 --karg=rootwait testos:testos/buildmain/x86_64-runtime - assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'rootwait' - assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' - assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' + assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'rootwait' + assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'init=' + assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'initrd' echo "ok switching to bootdir with no initramfs layout=$layout" pull_test_tree "the kernel" "initramfs to assist the kernel" ${CMD_PREFIX} ostree admin deploy --os=testos --karg-none --karg=root=LABEL=rootfs testos:testos/buildmain/x86_64-runtime - assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' - assert_file_has_content sysroot/boot/$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf "initrd") "initramfs to assist the kernel" - assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'root=LABEL=rootfs' - assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'rootwait' - assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' + assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'initrd' + assert_file_has_content sysroot/boot/$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2.conf "initrd") "initramfs to assist the kernel" + assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'root=LABEL=rootfs' + assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'rootwait' + assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'init=' echo "ok switching from no initramfs to initramfs enabled sysroot layout=$layout" pull_test_tree "the kernel" "" "my .dtb file" ${CMD_PREFIX} ostree admin deploy --os=testos testos:testos/buildmain/x86_64-runtime - assert_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'init=' - assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2-testos.conf 'devicetree')" "my \.dtb file" - assert_not_file_has_content sysroot/boot/loader/entries/ostree-2-testos.conf 'initrd' + assert_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'init=' + assert_file_has_content sysroot/boot/"$(get_key_from_bootloader_conf sysroot/boot/loader/entries/ostree-2.conf 'devicetree')" "my \.dtb file" + assert_not_file_has_content sysroot/boot/loader/entries/ostree-2.conf 'initrd' echo "ok switching from initramfs to no initramfs sysroot with devicetree layout=$layout" done