summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-12-21 16:53:47 +0200
committerTimo Teras <timo.teras@iki.fi>2009-12-21 16:53:47 +0200
commit6417de4d1057675bacc06274cab385810b86eed7 (patch)
tree3ac64f217deadd9acd12d5de6cdf665a36086baa
parentf44f34811dde4e33210e83af8584a99543d528a8 (diff)
downloadapk-tools-6417de4d1057675bacc06274cab385810b86eed7.tar.bz2
apk-tools-6417de4d1057675bacc06274cab385810b86eed7.tar.xz
apk: remove the unneeded --never-overwrite
turns out the logic does not work with overlays as expected due to busybox symlinks being unmanaged. remove the useless option.
-rw-r--r--src/apk.c4
-rw-r--r--src/apk_defines.h3
-rw-r--r--src/archive.c19
-rw-r--r--src/database.c8
4 files changed, 5 insertions, 29 deletions
diff --git a/src/apk.c b/src/apk.c
index ee6690f..76c1e4e 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -57,7 +57,6 @@ static struct apk_option generic_options[] = {
{ 0x108, "repositories-file", "Override repositories file",
required_argument, "REPOFILE" },
{ 0x109, "no-network", "Do not use network (cache is still used)" },
- { 0x110, "never-overwrite", "Never overwrite existing files" },
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
};
@@ -386,9 +385,6 @@ int main(int argc, char **argv)
case 0x109:
apk_flags |= APK_NO_NETWORK;
break;
- case 0x110:
- apk_flags |= APK_NEVER_OVERWRITE;
- break;
case 0x111:
apk_flags |= APK_OVERLAY_FROM_STDIN;
break;
diff --git a/src/apk_defines.h b/src/apk_defines.h
index 2e93151..7414159 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -64,8 +64,7 @@ extern unsigned int apk_flags;
#define APK_INTERACTIVE 0x0400
#define APK_RECURSIVE_DELETE 0x0800
#define APK_NO_NETWORK 0x1000
-#define APK_NEVER_OVERWRITE 0x2000
-#define APK_OVERLAY_FROM_STDIN 0x4000
+#define APK_OVERLAY_FROM_STDIN 0x2000
#define apk_error(args...) do { apk_log("ERROR: ", args); } while (0)
#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0)
diff --git a/src/archive.c b/src/archive.c
index a2707cd..b27c039 100644
--- a/src/archive.c
+++ b/src/archive.c
@@ -343,18 +343,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
if ((!S_ISDIR(ae->mode) && !S_ISREG(ae->mode)) ||
(ae->link_target != NULL)) {
/* non-standard entries need to be deleted first */
- if (apk_flags & APK_NEVER_OVERWRITE) {
- if (faccessat(atfd, ae->name, F_OK,
- AT_SYMLINK_NOFOLLOW) == 0) {
- /* destination exists, but we are not supposed
- * to overwrite, just clean the temp file */
- if (suffix != NULL)
- unlinkat(atfd, fn, 0);
- return 0;
- }
- } else {
- unlinkat(atfd, fn, 0);
- }
+ unlinkat(atfd, fn, 0);
}
switch (ae->mode & S_IFMT) {
@@ -367,14 +356,8 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
if (ae->link_target == NULL) {
int flags = O_RDWR | O_CREAT | O_TRUNC;
- if (apk_flags & APK_NEVER_OVERWRITE)
- flags |= O_EXCL;
-
fd = openat(atfd, fn, flags, ae->mode & 07777);
if (fd < 0) {
- if ((apk_flags & APK_NEVER_OVERWRITE) &&
- (errno == EEXIST))
- return 0;
r = -1;
break;
}
diff --git a/src/database.c b/src/database.c
index fef25f8..debe897 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1942,11 +1942,9 @@ static void apk_db_migrate_files(struct apk_database *db,
apk_checksum_compare(&file->csum, &fi.csum) == 0))
unlinkat(db->root_fd, tmpname, 0);
} else {
- /* check if want keep existing files */
- if ((ofile->name == NULL) ||
- ((apk_flags & APK_NEVER_OVERWRITE) &&
- (faccessat(db->root_fd, name, F_OK,
- AT_SYMLINK_NOFOLLOW) == 0))) {
+ if (ofile->name == NULL) {
+ /* File was from overlay, delete the
+ * packages version */
unlinkat(db->root_fd, tmpname, 0);
} else {
/* Overwrite the old file */