From owner-svn-src-all@FreeBSD.ORG Mon Dec 23 17:16:44 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B27EFB96; Mon, 23 Dec 2013 17:16:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9ED0F1E6B; Mon, 23 Dec 2013 17:16:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBNHGidT059757; Mon, 23 Dec 2013 17:16:44 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBNHGiMv059756; Mon, 23 Dec 2013 17:16:44 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201312231716.rBNHGiMv059756@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 23 Dec 2013 17:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259773 - head/usr.sbin/pkg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Dec 2013 17:16:44 -0000 Author: bapt Date: Mon Dec 23 17:16:44 2013 New Revision: 259773 URL: http://svnweb.freebsd.org/changeset/base/259773 Log: 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: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Mon Dec 23 17:14:11 2013 (r259772) +++ head/usr.sbin/pkg/pkg.c Mon Dec 23 17:16:44 2013 (r259773) @@ -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); }