apk: --force to overwrite files
parent
457943f83e
commit
a62dcf37c1
|
@ -24,7 +24,7 @@
|
||||||
const char *apk_root;
|
const char *apk_root;
|
||||||
struct apk_repository_url apk_repository_list;
|
struct apk_repository_url apk_repository_list;
|
||||||
int apk_verbosity = 1, apk_progress = 0, apk_upgrade = 0;
|
int apk_verbosity = 1, apk_progress = 0, apk_upgrade = 0;
|
||||||
int apk_clean = 0;
|
int apk_clean = 0, apk_force = 0;
|
||||||
int apk_cwd_fd;
|
int apk_cwd_fd;
|
||||||
|
|
||||||
void apk_log(const char *prefix, const char *format, ...)
|
void apk_log(const char *prefix, const char *format, ...)
|
||||||
|
@ -111,7 +111,7 @@ static struct apk_repository_url *apk_repository_new(const char *url)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NUM_GENERIC_OPTS 7
|
#define NUM_GENERIC_OPTS 8
|
||||||
static struct option generic_options[32] = {
|
static struct option generic_options[32] = {
|
||||||
{ "root", required_argument, NULL, 'p' },
|
{ "root", required_argument, NULL, 'p' },
|
||||||
{ "repository", required_argument, NULL, 'X' },
|
{ "repository", required_argument, NULL, 'X' },
|
||||||
|
@ -120,6 +120,7 @@ static struct option generic_options[32] = {
|
||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{ "progress", no_argument, &apk_progress, 1 },
|
{ "progress", no_argument, &apk_progress, 1 },
|
||||||
{ "clean-protected", no_argument, &apk_clean, 1 },
|
{ "clean-protected", no_argument, &apk_clean, 1 },
|
||||||
|
{ "force", no_argument, &apk_force, 1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern csum_t bad_checksum;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int apk_cwd_fd, apk_verbosity, apk_progress, apk_upgrade;
|
extern int apk_cwd_fd, apk_verbosity, apk_progress, apk_upgrade;
|
||||||
extern int apk_clean;
|
extern int apk_clean, apk_force;
|
||||||
|
|
||||||
#define apk_error(args...) apk_log("ERROR: ", args);
|
#define apk_error(args...) apk_log("ERROR: ", args);
|
||||||
#define apk_warning(args...) if (apk_verbosity > 0) { apk_log("WARNING: ", args); }
|
#define apk_warning(args...) if (apk_verbosity > 0) { apk_log("WARNING: ", args); }
|
||||||
|
|
|
@ -1053,10 +1053,18 @@ static int apk_db_install_archive_entry(void *_ctx,
|
||||||
if (file->diri != diri) {
|
if (file->diri != diri) {
|
||||||
opkg = file->diri->pkg;
|
opkg = file->diri->pkg;
|
||||||
if (opkg->name != pkg->name) {
|
if (opkg->name != pkg->name) {
|
||||||
apk_error("%s: Trying to overwrite %s owned by %s.\n",
|
if (!apk_force) {
|
||||||
pkg->name->name, ae->name, opkg->name->name);
|
apk_error("%s: Trying to overwrite %s "
|
||||||
|
"owned by %s.\n",
|
||||||
|
pkg->name->name, ae->name,
|
||||||
|
opkg->name->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
apk_warning("%s: Trying to overwrite %s "
|
||||||
|
"owned by %s.\n",
|
||||||
|
pkg->name->name, ae->name,
|
||||||
|
opkg->name->name);
|
||||||
|
}
|
||||||
|
|
||||||
apk_db_file_change_owner(db, file, diri,
|
apk_db_file_change_owner(db, file, diri,
|
||||||
&ctx->file_diri_node);
|
&ctx->file_diri_node);
|
||||||
|
|
Loading…
Reference in New Issue