.B service-rename (sr) <URI|alias> <new-alias>
Rename a service (installation source).
+.TP
+.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.
+
.SH "GLOBAL OPTIONS"
.TP
.I \-h, \-\-help
.I \-r, \-\-rug\-compatible
Turns on rug compatibility. See compatibility notes next to affected commands.
+.SH "FILES"
+.TP
+.B /var/lib/zypp/cache
+Directory for storing metadata contained in installation sources.
+
.SH "NOTE"
.LP
Currently, zypper can be run only by user with root privileges.
manager->store( "/", true /*metadata_cache*/ );
}
+void refresh_sources()
+{
+ zypp::storage::PersistentStorage store;
+ std::list<zypp::source::SourceInfo> sources;
+
+ try
+ {
+ store.init( "/" );
+ sources = store.storedSources();
+ }
+ catch ( const Exception &e )
+ {
+ cerr << _("Error reading system sources: ") << e.msg() << std::endl;
+ exit(-1);
+ }
+
+ for(std::list<zypp::source::SourceInfo>::const_iterator it = sources.begin();
+ it != sources.end() ; ++it)
+ {
+ try
+ {
+ cout << _("Refreshing ") << it->alias() << endl <<
+ "URI: " << it->url() << endl;
+ Source_Ref src = SourceFactory().createFrom(
+ it->type(), it->url(), it->path(), it->alias(), it->cacheDir(),
+ false, // base source
+ true); // autorefresh
+// src.refresh();
+ cout << "DONE" << endl << endl;
+ }
+ catch ( const zypp::Exception & ex )
+ {
+ cerr << _("Error while refreshing the source: ") << ex.asString();
+ // continuing with next source, however
+ }
+ }
+
+ cout << _("All sytem sources have been refreshed.") << endl;
+}
+
MediaWrapper::MediaWrapper (const string& filename_or_url) {
try {
// the interface cannot provide a "complete path" :-(
"\tservice-add, sa\t\tAdd a new service\n"
"\tservice-delete, sd\tDelete a service\n"
"\tservice-rename, sr\tRename a service\n"
+ "\trefresh, ref\t\tRefresh all installation sources\n"
"\tpatch-check, pchk\tCheck for patches\n"
"\tpatches, pch\t\tList patches\n"
"\tlist-updates, lu\tList updates\n"
"\n"
;
}
+ else if (command == "refresh" || command == "ref") {
+ static struct option refresh_options[] = {
+ {"help", no_argument, 0, 'h'}
+ };
+ specific_options = refresh_options;
+ specific_help = _("zypper refresh\n"
+ "\n"
+ "Refresh all installation sources found in system.\n")
+ ;
+ }
else if (command == "list-updates" || command == "lu") {
static struct option remove_options[] = {
{"type", required_argument, 0, 't'},
{"type", required_argument, 0, 't'},
{"sort-by-name", no_argument, 0, 0},
{"sort-by-catalog", no_argument, 0, 0},
- {"help", no_argument, 0, 0}
+ {"help", no_argument, 0, 'h'}
};
specific_options = search_options;
specific_help =
return 0;
}
+ // --------------------------( refresh )------------------------------------
+
+ if (command == "refresh" || command == "ref") {
+ if (help || copts.count("help")) {
+ cerr << specific_help;
+ return !help;
+ }
+
+ refresh_sources();
+ }
+
+
ResObject::Kind kind;
// --------------------------( remove/install )-----------------------------