From da48ed3e6f280d23021268e37e7f544db404359a Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 27 Feb 2025 07:12:07 +0000 Subject: [PATCH] src: fix `pkg bootstrap -y` Currently, this causes pkg to exit with the very unhelpful error message "pkg: unknown command: bootstrap" This used to have the same behavior as `pkg bootstrap`in older versions of pkg prior to commit fb9b33123. This commit restores the old behavior of `pkg bootstrap -y` and does not affect the behavior if `-f` is passed. Sponsored by: The FreeBSD Foundation References: https://github.com/ifreund/pkgbasify/issues/6 --- src/main.c | 2 +- tests/frontend/pkg.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 1b06bf9be..4a7e9c472 100644 --- a/src/main.c +++ b/src/main.c @@ -736,7 +736,7 @@ main(int argc, char **argv) break; } } - if (yes == 0 && force == 0) { + if (force == 0) { printf("pkg(8) already installed, use -f to force.\n"); exit(EXIT_SUCCESS); } else if (force == 1) { diff --git a/tests/frontend/pkg.sh b/tests/frontend/pkg.sh index 1f43e86ac..e65b8e9b9 100755 --- a/tests/frontend/pkg.sh +++ b/tests/frontend/pkg.sh @@ -7,7 +7,8 @@ tests_init \ pkg_config_defaults \ pkg_create_manifest_bad_syntax \ pkg_repo_load_order \ - double_entry + double_entry \ + bootstrap pkg_no_database_body() { atf_skip_on Linux Test fails on Linux @@ -101,3 +102,9 @@ PKG_ENV : { EOF atf_check -o ignore pkg -C ./pkg.conf -vv } + +bootstrap_body() +{ + atf_check -o ignore pkg bootstrap + atf_check -o ignore pkg bootstrap -y +}