diff options
author | bapt <bapt@FreeBSD.org> | 2013-12-23 17:16:44 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2013-12-23 17:16:44 +0000 |
commit | 06960fae5f2b616a07cafda8d36e4277bf9246bd (patch) | |
tree | 6171cc746751d098b321cdb99d6735b5cf2b9ed5 /usr.sbin/pkg | |
parent | 42f0c8aa514bd0cecb4db5f27342b33eb85eacee (diff) | |
download | FreeBSD-src-06960fae5f2b616a07cafda8d36e4277bf9246bd.zip FreeBSD-src-06960fae5f2b616a07cafda8d36e4277bf9246bd.tar.gz |
Do not print a question in non-interractive mode but explain why boostrapping
has failed and how to allow it to happen
Reported by: jmmv
Diffstat (limited to 'usr.sbin/pkg')
-rw-r--r-- | usr.sbin/pkg/pkg.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 89e07cc..021149f 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -821,6 +821,11 @@ static const char confirmation_message[] = "The package management tool is not yet installed on your system.\n" "Do you want to fetch and install it now? [y/N]: "; +static const char non_interractive_message[] = +"The package management tool is not yet installed on your system.\n" +"Please set ASSUME_ALWAYS_YES=yes environement variable to be able to boostrap " +"in non-interractive (stdin not being a tty)\n"; + static int pkg_query_yes_no(void) { @@ -939,10 +944,12 @@ main(int argc, char *argv[]) */ config_bool(ASSUME_ALWAYS_YES, &yes); if (!yes) { - printf("%s", confirmation_message); - if (!isatty(fileno(stdin))) + if (!isatty(fileno(stdin))) { + fprintf(stderr, non_interractive_message); exit(EXIT_FAILURE); + } + printf("%s", confirmation_message); if (pkg_query_yes_no() == 0) exit(EXIT_FAILURE); } |