summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/apk_database.h3
-rw-r--r--src/database.c6
-rw-r--r--src/del.c2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 19bafcd..2a7cb3b 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -156,7 +156,7 @@ struct apk_database {
unsigned int pending_triggers;
int performing_self_upgrade : 1;
int permanent : 1;
- int open_write : 1;
+ int autoupdate : 1;
int open_complete : 1;
int compat_newfeatures : 1;
int compat_notinstallable : 1;
@@ -211,6 +211,7 @@ struct apk_db_file *apk_db_file_query(struct apk_database *db,
#define APK_OPENF_NO_SYS_REPOS 0x0100
#define APK_OPENF_NO_INSTALLED_REPO 0x0200
#define APK_OPENF_CACHE_WRITE 0x0400
+#define APK_OPENF_NO_AUTOUPDATE 0x0800
#define APK_OPENF_NO_REPOS (APK_OPENF_NO_SYS_REPOS | \
APK_OPENF_NO_INSTALLED_REPO)
diff --git a/src/database.c b/src/database.c
index db34ed3..70a1053 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1519,7 +1519,9 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
r = -1;
goto ret_r;
}
- if (dbopts->open_flags & APK_OPENF_WRITE) db->open_write = 1;
+ if ((dbopts->open_flags & APK_OPENF_WRITE) &&
+ !(dbopts->open_flags & APK_OPENF_NO_AUTOUPDATE))
+ db->autoupdate = 1;
if (!dbopts->cache_dir) dbopts->cache_dir = "etc/apk/cache";
apk_db_setup_repositories(db, dbopts->cache_dir);
@@ -2266,7 +2268,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository)
r = apk_repo_format_real_url(db, repo, NULL, buf, sizeof(buf));
if (r == 0) apk_message("fetch %s", buf);
} else {
- if (db->open_write) apk_repository_update(db, repo);
+ if (db->autoupdate) apk_repository_update(db, repo);
r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo);
}
} else {
diff --git a/src/del.c b/src/del.c
index d1a6015..8e149ab 100644
--- a/src/del.c
+++ b/src/del.c
@@ -161,7 +161,7 @@ static struct apk_applet apk_del = {
.name = "del",
.help = "Remove PACKAGEs from 'world' and uninstall them",
.arguments = "PACKAGE...",
- .open_flags = APK_OPENF_WRITE,
+ .open_flags = APK_OPENF_WRITE | APK_OPENF_NO_AUTOUPDATE,
.command_groups = APK_COMMAND_GROUP_INSTALL,
.context_size = sizeof(struct del_ctx),
.optgroups = { &optgroup_global, &optgroup_commit, &optgroup_applet },