Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/pkg/pkg.c
Show First 20 Lines • Show All 1,044 Lines • ▼ Show 20 Lines | main(int argc, char *argv[]) | ||||
pkgarg = NULL; | pkgarg = NULL; | ||||
yes = false; | yes = false; | ||||
snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", | snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", | ||||
getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); | getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE); | ||||
if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { | if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { | ||||
bootstrap_only = true; | bootstrap_only = true; | ||||
if (argc == 3 && strcmp(argv[2], "-f") == 0) | if (argc > 3) { | ||||
fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n"); | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
if (argc == 3 && strcmp(argv[2], "-f") == 0) { | |||||
force = true; | force = true; | ||||
} else if (argc == 3) { | |||||
fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n"); | |||||
exit(EXIT_FAILURE); | |||||
} | |||||
} | } | ||||
if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { | if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { | ||||
/* | /* | ||||
* To allow 'pkg -N' to be used as a reliable test for whether | * To allow 'pkg -N' to be used as a reliable test for whether | ||||
* a system is configured to use pkg, don't bootstrap pkg | * a system is configured to use pkg, don't bootstrap pkg | ||||
* when that argument is given as argv[1]. | * when that argument is given as argv[1]. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |