Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2015 21:32:03 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r283790 - stable/10/usr.sbin/pkg
Message-ID:  <201505302132.t4ULW3Jt041583@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sat May 30 21:32:02 2015
New Revision: 283790
URL: https://svnweb.freebsd.org/changeset/base/283790

Log:
  MFC: r259773, r259774, r259775
  
  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

Modified:
  stable/10/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pkg/pkg.c
==============================================================================
--- stable/10/usr.sbin/pkg/pkg.c	Sat May 30 21:28:55 2015	(r283789)
+++ stable/10/usr.sbin/pkg/pkg.c	Sat May 30 21:32:02 2015	(r283790)
@@ -819,6 +819,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_interactive_message[] =
+"The package management tool is not yet installed on your system.\n"
+"Please set ASSUME_ALWAYS_YES=yes environment variable to be able to bootstrap "
+"in non-interactive (stdin not being a tty)\n";
+
 static int
 pkg_query_yes_no(void)
 {
@@ -937,10 +942,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_interactive_message);
 				exit(EXIT_FAILURE);
+			}
 
+			printf("%s", confirmation_message);
 			if (pkg_query_yes_no() == 0)
 				exit(EXIT_FAILURE);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505302132.t4ULW3Jt041583>