diff options
author | Timo Teräs <timo.teras@iki.fi> | 2015-01-30 14:35:02 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2015-01-30 14:35:02 +0200 |
commit | c553970061a61f4a6c62b8cf949f1012259854e6 (patch) | |
tree | 7c89fd843eb2f665289c13a743777c46405fdc42 /src | |
parent | 0276e227315f9ef94843d3bcf7f564221b150f26 (diff) | |
download | apk-tools-c553970061a61f4a6c62b8cf949f1012259854e6.tar.gz apk-tools-c553970061a61f4a6c62b8cf949f1012259854e6.tar.bz2 apk-tools-c553970061a61f4a6c62b8cf949f1012259854e6.tar.xz apk-tools-c553970061a61f4a6c62b8cf949f1012259854e6.zip |
remove support for old database location in /var
the location changed in apk-tools 2.1.0 (March 2011) which was
used in Alpine Linux 2.2.
Diffstat (limited to 'src')
-rw-r--r-- | src/apk_io.h | 1 | ||||
-rw-r--r-- | src/database.c | 25 | ||||
-rw-r--r-- | src/io.c | 31 |
3 files changed, 0 insertions, 57 deletions
diff --git a/src/apk_io.h b/src/apk_io.h index 82102aa..2e1c319 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -147,7 +147,6 @@ int apk_file_get_info(int atfd, const char *filename, unsigned int flags, typedef int apk_dir_file_cb(void *ctx, int dirfd, const char *entry); int apk_dir_foreach_file(int dirfd, apk_dir_file_cb cb, void *ctx); -int apk_move_file(int atfd, const char *from, const char *to); const char *apk_url_local_file(const char *url); void apk_id_cache_init(struct apk_id_cache *idc, int root_fd); diff --git a/src/database.c b/src/database.c index f94826b..5df3c68 100644 --- a/src/database.c +++ b/src/database.c @@ -57,20 +57,16 @@ static const char * const apk_lock_file = "var/lock/apkdb"; static const char * const apk_world_file = "etc/apk/world"; static const char * const apk_world_file_tmp = "etc/apk/world.new"; -static const char * const apk_world_file_old = "var/lib/apk/world"; static const char * const apk_arch_file = "etc/apk/arch"; static const char * const apk_scripts_file = "lib/apk/db/scripts.tar"; static const char * const apk_scripts_file_tmp = "lib/apk/db/scripts.tar.new"; -static const char * const apk_scripts_file_old = "var/lib/apk/scripts.tar"; static const char * const apk_triggers_file = "lib/apk/db/triggers"; static const char * const apk_triggers_file_tmp = "lib/apk/db/triggers.new"; -static const char * const apk_triggers_file_old = "var/lib/apk/triggers"; const char * const apk_installed_file = "lib/apk/db/installed"; static const char * const apk_installed_file_tmp = "lib/apk/db/installed.new"; -static const char * const apk_installed_file_old = "var/lib/apk/installed"; static struct apk_db_acl *apk_default_acl_dir, *apk_default_acl_file; @@ -1377,24 +1373,6 @@ static int do_remount(const char *path, const char *option) return WEXITSTATUS(status); } -static void relocate_database(struct apk_database *db) -{ - mkdirat(db->root_fd, "etc", 0755); - mkdirat(db->root_fd, "etc/apk", 0755); - mkdirat(db->root_fd, "lib", 0755); - mkdirat(db->root_fd, "lib/apk", 0755); - mkdirat(db->root_fd, "lib/apk/db", 0755); - mkdirat(db->root_fd, "var", 0755); - mkdirat(db->root_fd, "var/cache", 0755); - mkdirat(db->root_fd, "var/cache/apk", 0755); - mkdirat(db->root_fd, "var/cache/misc", 0755); - mkdirat(db->root_fd, "var/lock", 0755); - apk_move_file(db->root_fd, apk_world_file_old, apk_world_file); - apk_move_file(db->root_fd, apk_scripts_file_old, apk_scripts_file); - apk_move_file(db->root_fd, apk_triggers_file_old, apk_triggers_file); - apk_move_file(db->root_fd, apk_installed_file_old, apk_installed_file); -} - static void mark_in_cache(struct apk_database *db, int dirfd, const char *name, struct apk_package *pkg) { if (pkg == NULL) @@ -1509,9 +1487,6 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) apk_id_cache_init(&db->id_cache, db->root_fd); if (dbopts->open_flags & APK_OPENF_WRITE) { - if (faccessat(db->root_fd, apk_installed_file_old, F_OK, 0) == 0) - relocate_database(db); - db->lock_fd = openat(db->root_fd, apk_lock_file, O_CREAT | O_RDWR | O_CLOEXEC, 0600); if (db->lock_fd < 0 && errno == ENOENT && @@ -813,37 +813,6 @@ size_t apk_ostream_write_string(struct apk_ostream *os, const char *string) return len; } -int apk_move_file(int atfd, const char *from, const char *to) -{ - struct apk_istream *is; - struct stat64 st; - int rc, tofd; - - if (renameat(atfd, from, atfd, to) == 0) - return 0; - - if (fstatat64(atfd, from, &st, 0) != 0) - return -errno; - - is = apk_istream_from_file(atfd, from); - if (IS_ERR(is)) return PTR_ERR(is); - if (!is) return -ENOENT; - - tofd = openat(atfd, to, O_CREAT | O_RDWR | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (tofd < 0) { - rc = -errno; - goto close_is; - } - - rc = apk_istream_splice(is, tofd, st.st_size, NULL, NULL); - close(tofd); - unlinkat(atfd, from, 0); -close_is: - is->close(is); - return rc; -} - struct cache_item { apk_hash_node hash_node; unsigned int genid; |