Remove the non-user friendly --ask option
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
60dc4b43fd
commit
1ff8e7f364
3 changed files with 35 additions and 93 deletions
|
@ -255,13 +255,7 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||||
|
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
|
case PM_TRANS_CONV_INSTALL_IGNOREPKG:
|
||||||
if(config->noask) {
|
if(data2) {
|
||||||
if(config->ask & PM_TRANS_CONV_INSTALL_IGNOREPKG) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else if(data2) {
|
|
||||||
/* TODO we take this route based on data2 being not null? WTF */
|
/* TODO we take this route based on data2 being not null? WTF */
|
||||||
snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg. Install anyway? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: %s requires installing %s from IgnorePkg. Install anyway? [Y/n] "),
|
||||||
alpm_pkg_get_name(data1),
|
alpm_pkg_get_name(data1),
|
||||||
|
@ -274,56 +268,26 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_REMOVE_HOLDPKG:
|
case PM_TRANS_CONV_REMOVE_HOLDPKG:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_REMOVE_HOLDPKG) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: %s is designated as a HoldPkg. Remove anyway? [Y/n] "),
|
||||||
alpm_pkg_get_name(data1));
|
alpm_pkg_get_name(data1));
|
||||||
*response = yesno(str);
|
*response = yesno(str);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_REPLACE_PKG:
|
case PM_TRANS_CONV_REPLACE_PKG:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_REPLACE_PKG) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: Replace %s with %s/%s? [Y/n] "),
|
||||||
alpm_pkg_get_name(data1),
|
alpm_pkg_get_name(data1),
|
||||||
(char *)data3,
|
(char *)data3,
|
||||||
alpm_pkg_get_name(data2));
|
alpm_pkg_get_name(data2));
|
||||||
*response = yesno(str);
|
*response = yesno(str);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_CONFLICT_PKG:
|
case PM_TRANS_CONV_CONFLICT_PKG:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_CONFLICT_PKG) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: %s conflicts with %s. Remove %s? [Y/n] "),
|
||||||
(char *)data1,
|
(char *)data1,
|
||||||
(char *)data2,
|
(char *)data2,
|
||||||
(char *)data2);
|
(char *)data2);
|
||||||
*response = yesno(str);
|
*response = yesno(str);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_LOCAL_NEWER:
|
case PM_TRANS_CONV_LOCAL_NEWER:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_LOCAL_NEWER) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!config->op_s_downloadonly) {
|
if(!config->op_s_downloadonly) {
|
||||||
snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is newer. Upgrade anyway? [Y/n] "),
|
||||||
alpm_pkg_get_name(data1),
|
alpm_pkg_get_name(data1),
|
||||||
|
@ -332,16 +296,8 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||||
} else {
|
} else {
|
||||||
*response = 1;
|
*response = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_LOCAL_UPTODATE:
|
case PM_TRANS_CONV_LOCAL_UPTODATE:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_LOCAL_UPTODATE) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!config->op_s_downloadonly) {
|
if(!config->op_s_downloadonly) {
|
||||||
snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: %s-%s: local version is up to date. Upgrade anyway? [Y/n] "),
|
||||||
alpm_pkg_get_name(data1),
|
alpm_pkg_get_name(data1),
|
||||||
|
@ -350,16 +306,8 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||||
} else {
|
} else {
|
||||||
*response = 1;
|
*response = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case PM_TRANS_CONV_CORRUPTED_PKG:
|
case PM_TRANS_CONV_CORRUPTED_PKG:
|
||||||
if(config->noask) {
|
|
||||||
if(config->ask & PM_TRANS_CONV_CORRUPTED_PKG) {
|
|
||||||
*response = 1;
|
|
||||||
} else {
|
|
||||||
*response = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!config->noconfirm) {
|
if(!config->noconfirm) {
|
||||||
snprintf(str, LOG_STR_LEN, _(":: Archive %s is corrupted. Do you want to delete it? [Y/n] "),
|
snprintf(str, LOG_STR_LEN, _(":: Archive %s is corrupted. Do you want to delete it? [Y/n] "),
|
||||||
(char *)data1);
|
(char *)data1);
|
||||||
|
@ -367,7 +315,6 @@ void cb_trans_conv(pmtransconv_t event, void *data1, void *data2,
|
||||||
} else {
|
} else {
|
||||||
*response = 1;
|
*response = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,6 @@ typedef struct __config_t {
|
||||||
|
|
||||||
unsigned short group;
|
unsigned short group;
|
||||||
pmtransflag_t flags;
|
pmtransflag_t flags;
|
||||||
unsigned short noask;
|
|
||||||
unsigned int ask;
|
|
||||||
|
|
||||||
/* conf file options */
|
/* conf file options */
|
||||||
unsigned short chomp; /* I Love Candy! */
|
unsigned short chomp; /* I Love Candy! */
|
||||||
|
|
|
@ -141,7 +141,6 @@ static void usage(int op, char *myname)
|
||||||
}
|
}
|
||||||
printf(_(" --config <path> set an alternate configuration file\n"));
|
printf(_(" --config <path> set an alternate configuration file\n"));
|
||||||
printf(_(" --noconfirm do not ask for any confirmation\n"));
|
printf(_(" --noconfirm do not ask for any confirmation\n"));
|
||||||
printf(_(" --ask <number> pre-specify answers for questions (see manpage)\n"));
|
|
||||||
printf(_(" --noprogressbar do not show a progress bar when downloading files\n"));
|
printf(_(" --noprogressbar do not show a progress bar when downloading files\n"));
|
||||||
printf(_(" --noscriptlet do not execute the install scriptlet if one exists\n"));
|
printf(_(" --noscriptlet do not execute the install scriptlet if one exists\n"));
|
||||||
printf(_(" -v, --verbose be verbose\n"));
|
printf(_(" -v, --verbose be verbose\n"));
|
||||||
|
@ -285,7 +284,6 @@ static int parseargs(int argc, char *argv[])
|
||||||
{"debug", optional_argument, 0, 1003},
|
{"debug", optional_argument, 0, 1003},
|
||||||
{"noprogressbar", no_argument, 0, 1004},
|
{"noprogressbar", no_argument, 0, 1004},
|
||||||
{"noscriptlet", no_argument, 0, 1005},
|
{"noscriptlet", no_argument, 0, 1005},
|
||||||
{"ask", required_argument, 0, 1006},
|
|
||||||
{"cachedir", required_argument, 0, 1007},
|
{"cachedir", required_argument, 0, 1007},
|
||||||
{"asdeps", no_argument, 0, 1008},
|
{"asdeps", no_argument, 0, 1008},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
|
@ -330,7 +328,6 @@ static int parseargs(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 1004: config->noprogressbar = 1; break;
|
case 1004: config->noprogressbar = 1; break;
|
||||||
case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
|
case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
|
||||||
case 1006: config->noask = 1; config->ask = atoi(optarg); break;
|
|
||||||
case 1007:
|
case 1007:
|
||||||
if(alpm_option_add_cachedir(optarg) != 0) {
|
if(alpm_option_add_cachedir(optarg) != 0) {
|
||||||
pm_printf(PM_LOG_ERROR, _("problem adding cachedir '%s' (%s)\n"),
|
pm_printf(PM_LOG_ERROR, _("problem adding cachedir '%s' (%s)\n"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue