[sword-svn] r3378 - trunk/utilities

refdoc at crosswire.org refdoc at crosswire.org
Wed Aug 19 11:43:00 MST 2015


Author: refdoc
Date: 2015-08-19 11:43:00 -0700 (Wed, 19 Aug 2015)
New Revision: 3378

Modified:
   trunk/utilities/installmgr.cpp
Log:
added option to override disclaimer to improve usefulness for scripting


Modified: trunk/utilities/installmgr.cpp
===================================================================
--- trunk/utilities/installmgr.cpp	2015-08-19 11:25:25 UTC (rev 3377)
+++ trunk/utilities/installmgr.cpp	2015-08-19 18:43:00 UTC (rev 3378)
@@ -47,6 +47,8 @@
 SWBuf baseDir;
 SWBuf confPath;
 
+bool isConfirmed;
+
 void usage(const char *progName = 0, const char *error = 0);
 
 class MyInstallMgr : public InstallMgr {
@@ -55,6 +57,10 @@
 
 virtual bool isUserDisclaimerConfirmed() const {
 	static bool confirmed = false;
+	
+	if (isConfirmed) { 
+		confirmed = true;
+	}
         if (!confirmed) {
 		cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
 		cout << "                -=+* WARNING *+=- -=+* WARNING *+=-\n\n\n";
@@ -323,7 +329,12 @@
 
 	if (error) fprintf(stderr, "\n%s: %s\n", (progName ? progName : "installmgr"), error);
 
-	fprintf(stderr, "\nusage: %s <command> [command ...]\n"
+	fprintf(stderr, "\nusage: %s [--allow...] <command> [command ...]\n"
+		"\n\t --allow-internet-access-and-risk-tracing-and-jail-or-martyrdom \n"
+		"\n  This aptly named option will allow the program to connect to the internet without asking for user confirmation\n"
+		"  In many places this may well be a risky or even foolish undertaking.\n"
+		"  Please take special care before you use this option in scripts, particularly in scripts you want to offer for public download.\n" 
+		"  What may appear to be safe for you, may well not be safe for someone else, who uses your scripts. \n"
 		"\n  Commands (run in order they are passed):\n\n"
 		"\t-init\t\t\t\tcreate a basic user config file.\n"
 		"\t\t\t\t\t\tWARNING: overwrites existing.\n"
@@ -345,13 +356,18 @@
 
 
 int main(int argc, char **argv) {
-
+	
+	isConfirmed = false;
+	
 	if (argc < 2) usage(*argv);
 
 	for (int i = 1; i < argc; i++) {
 		if (!strcmp(argv[i], "-d")) {
 			SWLog::getSystemLog()->setLogLevel(SWLog::LOG_DEBUG);
 		}
+		else if (!strcmp(argv[i], "--allow-internet-access-and-risk-tracing-and-jail-or-martyrdom")) {
+			isConfirmed = true;
+		}
 		else if (!strcmp(argv[i], "-init")) {
 			initConfig();
 		}




More information about the sword-cvs mailing list