diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-04-09 20:42:01 -0400 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2017-04-12 11:47:33 +1000 |
commit | 04d211effa8d65020887112ee30c7b3b0fc28ad3 (patch) | |
tree | 9939b65851a6fc5bb6a0863d286b8da0d4876e74 /src/pacman | |
parent | 86f5c74694cb0403eaf11fa4734f307a0df345cb (diff) |
add --overwrite option to ignore file conflicts
Allows for safer, more fine-grained control for overwriting files than
--force's all-or-nothing approach.
Implements FS#31549.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman')
-rw-r--r-- | src/pacman/conf.c | 2 | ||||
-rw-r--r-- | src/pacman/conf.h | 2 | ||||
-rw-r--r-- | src/pacman/pacman.c | 6 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 49b21366..261c8213 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -783,6 +783,8 @@ static int setup_libalpm(void) alpm_option_set_cachedirs(handle, config->cachedirs); } + alpm_option_set_overwrite_files(handle, config->overwrite_files); + alpm_option_set_default_siglevel(handle, config->siglevel); config->localfilesiglevel = merge_siglevel(config->siglevel, diff --git a/src/pacman/conf.h b/src/pacman/conf.h index bd8cd77a..e67f7c51 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -123,6 +123,7 @@ typedef struct __config_t { alpm_list_t *assumeinstalled; alpm_list_t *noupgrade; alpm_list_t *noextract; + alpm_list_t *overwrite_files; char *xfercommand; /* our connection to libalpm */ @@ -172,6 +173,7 @@ enum { OP_GPGDIR, OP_DBONLY, OP_FORCE, + OP_OVERWRITE_FILES, OP_COLOR, OP_DBPATH, OP_CASCADE, diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index fe96cb3b..e0e7d01d 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -190,6 +190,8 @@ static void usage(int op, const char * const myname) case PM_OP_SYNC: case PM_OP_UPGRADE: addlist(_(" --force force install, overwrite conflicting files\n")); + addlist(_(" --overwrite <path>\n" + " overwrite conflicting files (can be used more than once)\n")); addlist(_(" --asdeps install packages as non-explicitly installed\n")); addlist(_(" --asexplicit install packages as explicitly installed\n")); addlist(_(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n")); @@ -708,6 +710,9 @@ static int parsearg_upgrade(int opt) case OP_FORCE: config->flags |= ALPM_TRANS_FLAG_FORCE; break; + case OP_OVERWRITE_FILES: + parsearg_util_addlist(&(config->overwrite_files)); + break; case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break; @@ -929,6 +934,7 @@ static int parseargs(int argc, char *argv[]) {"assume-installed", required_argument, 0, OP_ASSUMEINSTALLED}, {"debug", optional_argument, 0, OP_DEBUG}, {"force", no_argument, 0, OP_FORCE}, + {"overwrite", required_argument, 0, OP_OVERWRITE_FILES}, {"noprogressbar", no_argument, 0, OP_NOPROGRESSBAR}, {"noscriptlet", no_argument, 0, OP_NOSCRIPTLET}, {"ask", required_argument, 0, OP_ASK}, |