[zypp-commit] r10059 - in /trunk/zypper/src: zypper-keyring-callbacks.h zypper-misc.cc zypper-repos.cc zypper.cc zypper.h
Author: jreidinger Date: Tue May 13 11:59:54 2008 New Revision: 10059 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10059&view=rev Log: allow non-root user handling with their specified root dir Modified: trunk/zypper/src/zypper-keyring-callbacks.h trunk/zypper/src/zypper-misc.cc trunk/zypper/src/zypper-repos.cc trunk/zypper/src/zypper.cc trunk/zypper/src/zypper.h Modified: trunk/zypper/src/zypper-keyring-callbacks.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-keyring-callbacks.h?rev=10059&r1=10058&r2=10059&view=diff ============================================================================== --- trunk/zypper/src/zypper-keyring-callbacks.h (original) +++ trunk/zypper/src/zypper-keyring-callbacks.h Tue May 13 11:59:54 2008 @@ -52,7 +52,8 @@ virtual bool askUserToImportKey( const PublicKey &key ) { - if ( geteuid() != 0 ) + //this is because only root have access to rpm db where is keys stored + if ( geteuid() != 0 && !_gopts.changedRoot) return false; std::string question = boost::str(boost::format( Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=10059&r1=10058&r2=10059&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Tue May 13 11:59:54 2008 @@ -2276,7 +2276,8 @@ if (retv != SUMMARY_NOTHING_TO_DO || !zypper.runtimeData().srcpkgs_to_install.empty()) { // check root user - if (zypper.command() == ZypperCommand::VERIFY && geteuid() != 0) + if (zypper.command() == ZypperCommand::VERIFY && geteuid() != 0 + && !zypper.globalOpts().changedRoot) { zypper.out().error( _("Root privileges are required to fix broken package dependencies.")); Modified: trunk/zypper/src/zypper-repos.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-repos.cc?rev=10059&r1=10058&r2=10059&view=diff ============================================================================== --- trunk/zypper/src/zypper-repos.cc (original) +++ trunk/zypper/src/zypper-repos.cc Tue May 13 11:59:54 2008 @@ -437,7 +437,7 @@ MIL << "calling refresh for " << repo.name() << endl; // handle root user differently - if (geteuid() == 0) + if (geteuid() == 0 && !zypper.globalOpts().changedRoot) { if (refresh_raw_metadata(zypper, repo, false) || build_cache(zypper, repo, false)) @@ -474,7 +474,7 @@ else if (repo.enabled()) { // handle root user differently - if (geteuid() == 0) + if (geteuid() == 0 && !zypper.globalOpts().changedRoot) { if (build_cache(zypper, repo, false)) { Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=10059&r1=10058&r2=10059&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Tue May 13 11:59:54 2008 @@ -406,6 +406,7 @@ if ((it = gopts.find("root")) != gopts.end()) { _gopts.root_dir = it->second.front(); + _gopts.changedRoot = true; Pathname tmp(_gopts.root_dir); if (!tmp.absolute()) { @@ -1941,7 +1942,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for modifying system repositories.")); @@ -2076,7 +2077,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for modifying system repositories.")); @@ -2131,7 +2132,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for modifying system repositories.")); @@ -2187,7 +2188,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for modifying system repositories.")); @@ -2252,7 +2253,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for refreshing system repositories.")); @@ -2276,7 +2277,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for cleaning local caches.")); @@ -2309,7 +2310,7 @@ _cmdopts.license_auto_agree = true; // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for installing or uninstalling packages.")); @@ -2867,7 +2868,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for updating packages.")); @@ -2951,7 +2952,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for performing a distribution upgrade.")); @@ -3046,7 +3047,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for adding of package locks.")); @@ -3112,7 +3113,7 @@ if (runningHelp()) { out().info(_command_help, Out::QUIET); return; } // check root user - if (geteuid() != 0) + if (geteuid() != 0 && !globalOpts().changedRoot) { out().error( _("Root privileges are required for adding of package locks.")); @@ -3170,7 +3171,7 @@ Locks::instance().save(); - out().info(str::form("removed locks: %u", start - Locks::instance().size())); + out().info(str::form("removed locks: %lu", (long unsigned)(start - Locks::instance().size()))); break; } Modified: trunk/zypper/src/zypper.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.h?rev=10059&r1=10058&r2=10059&view=diff ============================================================================== --- trunk/zypper/src/zypper.h (original) +++ trunk/zypper/src/zypper.h Tue May 13 11:59:54 2008 @@ -38,7 +38,8 @@ no_refresh(false), root_dir("/"), no_abbrev(false), - terse(false) + terse(false), + changedRoot(false) {} // std::listzypp::Url additional_sources; @@ -66,6 +67,7 @@ zypp::RepoManagerOptions rm_options; bool no_abbrev; bool terse; + bool changedRoot; }; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
jreidinger@svn.opensuse.org