Index: usr.sbin/pkg/pkg.c =================================================================== --- usr.sbin/pkg/pkg.c +++ usr.sbin/pkg/pkg.c @@ -1038,6 +1038,17 @@ return (ret); } +static const char *pkg_pkg = "pkg."; +static const char *pkg_devel_pkg = "pkg-devel."; + +static bool +pkg_is_pkg_pkg(const char *pkg) +{ + + return (strncmp(pkg, pkg_pkg, sizeof(pkg_pkg) - 1) == 0 || + strncmp(pkg, pkg_devel_pkg, sizeof(pkg_devel_pkg) - 1) == 0); +} + int main(int argc, char *argv[]) { @@ -1141,13 +1152,25 @@ fprintf(stderr, args_bootstrap_message); exit(EXIT_FAILURE); } - // For add, we accept exactly one further argument else if (add_pkg && pkgarg != NULL) { - fprintf(stderr, args_add_message); - exit(EXIT_FAILURE); + /* + * Additional arguments also means it's not a + * local bootstrap request. + */ + add_pkg = false; } else if (add_pkg) { - pkgarg = argv[optind-1]; + /* + * If it's not a request for pkg or pkg-devel, + * then we must assume they were trying to + * install some other local package and we + * should try to bootstrap from the repo. + */ + if (!pkg_is_pkg_pkg(argv[optind-1])) { + add_pkg = false; + } else { + pkgarg = argv[optind-1]; + } } break; default: