In preparation for making 'pkg -n' the one true method of determining
whether a system has been configured to use pkgng, cause /usr/sbin/pkg recognise a -n option and exit with a failure code when the pkg port is not installed. Approved by: bapt MFC after: 2 weeks
This commit is contained in:
parent
4cead97615
commit
ecfed9f2eb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=244553
@ -452,6 +452,16 @@ main(__unused int argc, char *argv[])
|
||||
getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE);
|
||||
|
||||
if (access(pkgpath, X_OK) == -1) {
|
||||
/*
|
||||
* To allow 'pkg -n' to be used as a reliable test for whether
|
||||
* a system is configured to use pkg, don't bootstrap pkg
|
||||
* when that argument is given as argv[1].
|
||||
*/
|
||||
if ( argv[1] != NULL && strcmp(argv[1], "-n") == 0) {
|
||||
printf("%s", "pkg is not installed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do not ask for confirmation if either of stdin or stdout is
|
||||
* not tty. Check the environment to see if user has answer
|
||||
|
Loading…
Reference in New Issue
Block a user