- --auto-agree-with-licenses added
authorJan Kupec <jkupec@suse.cz>
Wed, 18 Jul 2007 18:50:54 +0000 (18:50 +0000)
committerJan Kupec <jkupec@suse.cz>
Wed, 18 Jul 2007 18:50:54 +0000 (18:50 +0000)
doc/zypper.8
src/zypper-misc.cc
src/zypper-rpm-callbacks.h
src/zypper-source-callbacks.h
src/zypper.cc
src/zypper.h

index b3b63ff..4b65ade 100644 (file)
@@ -58,8 +58,11 @@ Only from this catalog (FIXME not implemented yet)
 \fI\-t, \-\-type\fR <resolvable_type>
 Type of resolvable (default: package)
 .TP
-.I \-y, \-\-no-confirm
-Don't require user confirmation.
+.I \-y, \-\-no\-confirm
+Don't require user confirmation to proceed with installation.
+.TP
+.I \-l, \-\-auto\-agree\-with\-licenses
+Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before.
 
 .TP
 .B list-updates (lu) [options]
@@ -91,10 +94,13 @@ Type of resolvable (default: patch)
 .I \-y, \-\-no-confirm
 Don't require user confirmation.
 .TP
-.I \-\-skip\-interactive
-This will skip interactive patches, that is those that need a reboot,
+.I     \-\-skip\-interactive
+This will skip interactive patches, that is, those that need reboot,
 contain a message, or update a package whose license needs to be
 confirmed.
+.TP
+.I \-l, \-\-auto\-agree\-with\-licenses
+Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before.
 
 .B NOTE:
 Zypper prefers to update only those packages for which a patch
@@ -191,6 +197,8 @@ Add the repository as disabled.
 .TP
 \fI\-n, \-\-no\-refresh\fR 
 Add the repository with auto-refresh disabled.
+.TP
+NOTE: This command does not automatically refresh the newly added repositories. You have to use the \fBrefresh\fR command after finishing your modifications to repositories with \fB*repo\fR commands.
 
 .TP
 .B removerepo (rr) [options] <alias|URI>
@@ -234,7 +242,7 @@ Disable auto-refresh for the repository.
 .B refresh (ref)
 Refresh all installation sources found in system.
 .IP
-This means downloading resolvables' metadata from source media and storing it in local cache, typically under /var/lib/zypp/cache.
+This means downloading resolvables' metadata from source media (if needed), storing it in local cache (typically under /var/lib/zypp/cache/raw directory) and preparsing the metadata into an sqlite database (/var/lib/zypp/cache/zypp.db).
 
 .SH "GLOBAL OPTIONS"
 .TP 
@@ -248,7 +256,7 @@ Print zypper version number and exit.
 Increase verbosity. For debugging output specify this option twice.
 .TP
 .I \-q, \-\-quiet
-Suppress normal output. Brief error messages will still be printed on standard error output. If used together with conflicting --verbose option, the --verbose option takes preference.
+Suppress normal output. Brief messages will still be printed though. If used together with conflicting --verbose option, the --verbose option takes preference.
 .TP
 .I \-t, \-\-terse
 Terse output for machine consumption.
@@ -260,7 +268,7 @@ Specifies table style to use. Table style is identified by an integer number. TO
 Turns on rug compatibility. See compatibility notes next to affected commands.
 .TP
 .I      \-\-non\-interactive
-Switches to non-interactive mode. In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically. (Under development, use only with install, update, and remove commands for other than debugging purposes)
+Switches to non-interactive mode. In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
 .TP
 .I      \-\-no\-gpg\-checks
 Ignore gpg check failures and continue.
@@ -270,8 +278,14 @@ Operates on a different root directory.
 
 .SH "FILES"
 .TP
-.B /var/lib/zypp/cache
-Directory for storing metadata contained in installation sources.
+.B /etc/zypp/repos.d
+Directory containing repository configuration (*.repo) files. You can use the \fBrepo\fR commands to manipulate these files, or you can edit them yourself. In either case, after doing the modifications, executing \fBzypper refresh\fR is strongly recommended.
+.TP
+.B /var/lib/zypp/cache/raw
+Directory for storing raw metadata contained in repositories.
+.TP
+.B /var/lib/zypp/cache/zypp.db
+Sqlite database file containing pre-parsed metadata of all repositories.
 .TP
 .B ~/.zypper_history
 Command history for the shell.
index be9c099..886b8e2 100644 (file)
@@ -975,6 +975,20 @@ bool confirm_licenses(bool non_interactive)
     if (it->status().isToBeInstalled() &&
         !it->resolvable()->licenseToConfirm().empty())
     {
+      if (gSettings.license_auto_agree)
+      {
+        // TranslatorExplanation The first %s is name of the resolvable, the second is its kind (e.g. 'zypper package')
+        cout << format(_("Automatically agreeing with %s %s license."))
+            % it->resolvable()->name() % it->resolvable()->kind().asString()
+            << endl;
+
+        MIL << format("Automatically agreeing with %s %s license.")
+            % it->resolvable()->name() % it->resolvable()->kind().asString()
+            << endl;
+
+        continue;
+      }
+
       cout << it->resolvable()->name() << " " <<
         it->resolvable()->kind().asString() <<
         " " << _("license") << ": " <<
index 5dacd4f..70c7faa 100644 (file)
@@ -144,7 +144,7 @@ struct RemoveResolvableReportReceiver : public zypp::callback::ReceiveReport<zyp
   {
     cerr << resolvable << endl;
     display_error (error, description);
-    return (Action) read_action_ari ();
+    return (Action) read_action_ari (ABORT);
   }
 
   virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason )
@@ -193,7 +193,7 @@ struct InstallResolvableReportReceiver : public zypp::callback::ReceiveReport<zy
       cerr_v << "Will retry more aggressively" << endl;
       return ABORT;
     }
-    return (Action) read_action_ari ();
+    return (Action) read_action_ari (ABORT);
   }
 
   virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason, RpmLevel level )
index 31f61c0..53f86ac 100644 (file)
@@ -275,7 +275,7 @@ struct RepoReportReceiver  : public zypp::callback::ReceiveReport<zypp::repo::Re
   {
     display_done ();
     display_error (error, description);
-    return (Action) read_action_ari ();
+    return (Action) read_action_ari (ABORT);
   }
 
   virtual void finish( zypp::Repository /*repo*/, const std::string & task, Error error, const std::string & reason )
index 872c32c..5413a2e 100644 (file)
@@ -257,10 +257,11 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
   }
   else if (command == ZypperCommand::INSTALL) {
     static struct option install_options[] = {
-      {"catalog",         required_argument, 0, 'c'},
-      {"type",      required_argument, 0, 't'},
-      {"no-confirm", no_argument,       0, 'y'},
-      {"help",       no_argument,       0, 'h'},
+      {"catalog",                  required_argument, 0, 'c'},
+      {"type",                     required_argument, 0, 't'},
+      {"no-confirm",                no_argument,       0, 'y'},
+      {"auto-agree-with-licenses",  no_argument,       0, 'l'},
+      {"help",                      no_argument,       0, 'h'},
       {0, 0, 0, 0}
     };
     specific_options = install_options;
@@ -272,7 +273,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "  Command options:\n"
       "\t--catalog,-c\t\t\tOnly from this catalog (under development)\n"
       "\t--type,-t <resolvable_type>\tType of resolvable (default: package)\n"
-      "\t--no-confirm,-y\t\t\tDo not require user confirmation\n"
+      "\t--no-confirm,-y\t\t\tDo not require user confirmation to proceed with installation\n"
+      "\t--auto-agree-with-licenses,-l\tAutomatically say 'yes' to third party license confirmation prompt.\n"
+      "\t\t\t\t\tSee man zypper for more details.\n"
       );
   }
   else if (command == ZypperCommand::REMOVE) {
@@ -415,9 +418,10 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
   }
   else if (command == ZypperCommand::UPDATE) {
     static struct option update_options[] = {
-      {"type",            required_argument, 0, 't'},
-      {"no-confirm", no_argument,       0, 'y'},
-      {"skip-interactive", no_argument, 0, 0},
+      {"type",                     required_argument, 0, 't'},
+      {"no-confirm",                no_argument,       0, 'y'},
+      {"skip-interactive",          no_argument,       0, 0},
+      {"auto-agree-with-licenses",  no_argument,       0, 'l'},
       {"help", no_argument, 0, 'h'},
       {0, 0, 0, 0}
     };
@@ -430,6 +434,8 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       "\t--type,-t <resolvable_type>\tType of resolvable (default: patch)\n"
       "\t--no-confirm,-y\t\t\tDo not require user confirmation\n"
       "\t--skip-interactive\t\tSkip interactive updates\n"
+      "\t--auto-agree-with-licenses,-l\tAutomatically say 'yes' to third party license confirmation prompt.\n"
+      "\t\t\t\t\tSee man zypper for more details.\n"
       );
   }
   else if (command == ZypperCommand::SEARCH) {
@@ -873,6 +879,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       }
 
       gData.packages_to_install = arguments;
+
+      if (copts.count("auto-agree-with-licenses"))
+        gSettings.license_auto_agree = true;
     }
 
     if (command == ZypperCommand::REMOVE) {
@@ -1091,6 +1100,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
       return ZYPPER_EXIT_ERR_PRIVILEGES;
     }
 
+    if (copts.count("auto-agree-with-licenses"))
+      gSettings.license_auto_agree = true;
+
     string skind = copts.count("type")?  copts["type"].front() :
       gSettings.is_rug_compatible? "package" : "patch";
     kind = string_to_kind (skind);
index 2edbeec..865c79d 100644 (file)
@@ -50,6 +50,7 @@ struct Settings
   is_rug_compatible(false),
   non_interactive(false),
   no_gpg_checks(false),
+  license_auto_agree(false),
   root_dir("/")
   {}
 
@@ -74,6 +75,7 @@ struct Settings
   bool is_rug_compatible;
   bool non_interactive;
   bool no_gpg_checks;
+  bool license_auto_agree;
   std::string root_dir;
 };