_arguments.clear();
// clear command options
if (!_copts.empty())
- {
_copts.clear();
- _cmdopts = CommandOptions();
- }
// clear the command
_command = ZypperCommand::NONE;
// clear command help text
return;
}
- if (copts.count("auto-agree-with-licenses")
- || copts.count("agree-to-third-party-licenses"))
- _cmdopts.license_auto_agree = true;
-
// check root user
if (geteuid() != 0 && !globalOpts().changedRoot)
{
if (copts.count("no-confirm"))
_gopts.non_interactive = true;
- if (copts.count("auto-agree-with-licenses")
- || copts.count("agree-to-third-party-licenses"))
- _cmdopts.license_auto_agree = true;
-
ResKindSet kinds;
if (copts.count("type"))
{
return;
}
- if (copts.count("auto-agree-with-licenses"))
- _cmdopts.license_auto_agree = true;
-
initRepoManager();
init_target(*this);
init_repos(*this);
bool changedRoot;
};
-
-struct CommandOptions
-{
- CommandOptions()
- :
- license_auto_agree(false)
- {}
-
- bool license_auto_agree;
-};
-
struct RuntimeData
{
RuntimeData()
// setters & getters
Out & out();
const GlobalOptions & globalOpts() const { return _gopts; }
- const CommandOptions & cmdOpts() const { return _cmdopts; }
const parsed_opts & cOpts() const { return _copts; }
const ZypperCommand & command() const { return _command; }
const std::string & commandHelp() const { return _command_help; }
Out * _out_ptr;
GlobalOptions _gopts;
- CommandOptions _cmdopts;
parsed_opts _copts;
ZypperCommand _command;
ArgList _arguments;
bool confirm_licenses(Zypper & zypper)
{
bool confirmed = true;
+ bool license_auto_agree =
+ zypper.cOpts().count("auto-agree-with-licenses")
+ || zypper.cOpts().count("agree-to-third-party-licenses");
for (ResPool::const_iterator it = God->pool().begin(); it != God->pool().end(); ++it)
{
if (it->status().isToBeInstalled() &&
!it->resolvable()->licenseToConfirm().empty())
{
- if (zypper.cmdOpts().license_auto_agree)
+ if (license_auto_agree)
{
zypper.out().info(boost::str(
// TranslatorExplanation The first %s is name of the resolvable, the second is its kind (e.g. 'zypper package')
// lincense prompt
string question = _("Do you agree with the terms of the license?");
//! \todo add 'v' option to view the license again, add prompt help
- if (!read_bool_answer(PROMPT_YN_LICENSE_AGREE, question, zypper.cmdOpts().license_auto_agree))
+ if (!read_bool_answer(PROMPT_YN_LICENSE_AGREE, question, license_auto_agree))
{
confirmed = false;