Skip to content

Commit

Permalink
src: fix pkg bootstrap -y
Browse files Browse the repository at this point in the history
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 fb9b331.

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:	ifreund/pkgbasify#6
  • Loading branch information
ifreund committed Feb 27, 2025
1 parent f6a4eb6 commit da48ed3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion tests/frontend/pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit da48ed3

Please sign in to comment.