2009-04-16 17:05:22 +00:00
|
|
|
/* update.c - Alpine Package Keeper (APK)
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
|
|
|
|
* Copyright (C) 2008 Timo Teräs <timo.teras@iki.fi>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2009-06-25 12:14:07 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
2009-04-16 17:05:22 +00:00
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation. See http://www.gnu.org/ for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "apk_defines.h"
|
|
|
|
#include "apk_applet.h"
|
|
|
|
#include "apk_database.h"
|
|
|
|
#include "apk_version.h"
|
2010-03-05 08:13:25 +00:00
|
|
|
#include "apk_print.h"
|
2009-04-16 17:05:22 +00:00
|
|
|
|
2009-08-06 11:25:03 +00:00
|
|
|
static int update_main(void *ctx, struct apk_database *db, int argc, char **argv)
|
2009-04-16 17:05:22 +00:00
|
|
|
{
|
2009-09-03 10:56:24 +00:00
|
|
|
struct apk_repository *repo;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (apk_verbosity < 1)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; i < db->num_repos; i++) {
|
|
|
|
repo = &db->repos[i];
|
|
|
|
|
|
|
|
if (APK_BLOB_IS_NULL(repo->description))
|
|
|
|
continue;
|
|
|
|
|
2010-12-14 17:51:16 +00:00
|
|
|
apk_message(BLOB_FMT " [%s]",
|
|
|
|
BLOB_PRINTF(repo->description),
|
2009-09-03 10:56:24 +00:00
|
|
|
db->repos[i].url);
|
|
|
|
}
|
|
|
|
|
2009-04-16 17:05:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct apk_applet apk_update = {
|
|
|
|
.name = "update",
|
2009-06-25 12:14:07 +00:00
|
|
|
.help = "Update repository indexes from all remote repositories.",
|
2009-08-06 11:50:51 +00:00
|
|
|
.open_flags = APK_OPENF_WRITE,
|
2009-08-06 11:25:03 +00:00
|
|
|
.forced_flags = APK_UPDATE_CACHE,
|
2009-04-16 17:05:22 +00:00
|
|
|
.main = update_main,
|
|
|
|
};
|
|
|
|
|
|
|
|
APK_DEFINE_APPLET(apk_update);
|
|
|
|
|