xbps-bin: use xbps_noyes() in the install/update targets.
Now it looks like this: $ xbps-bin -r ~/blah install initscripts Finding/sorting required binary packages... Checking binary package file(s) integrity... The following new packages will be installed: xbps-base-files-0.8_1 gcc-libgcc-4.3.3 glibc-locales-2.9 ncurses-base-5.7 glibc-2.9 ncurses-libs-5.7 gawk-3.1.6 grep-2.5.4 coreutils-7.1 sed-4.1.5 ncurses-5.7 kbd-1.15 findutils-4.4.0_1 net-tools-1.60 rcorder-2009.01 minilogd-2009.01 dhcpcd-4.0.12 bash-4.0 procps-3.2.7 udev-140_2 initscripts-2009.03_2 Total download size: 16M Total installed size: 48M Do you want to continue? [y/N] ... --HG-- extra : convert_revision : e32a136ee882160637c1930d998c0f5ae3a6b108
This commit is contained in:
parent
aaf5f8fb40
commit
3698644967
|
@ -73,11 +73,12 @@ xbps_install_pkg(const char *pkg, bool update)
|
|||
prop_object_t obj;
|
||||
prop_object_iterator_t iter;
|
||||
uint64_t tsize = 0, dlsize = 0, instsize = 0;
|
||||
size_t cols = 0;
|
||||
const char *repoloc, *filename, *instver, *origin;
|
||||
const char *pkgname, *version;
|
||||
char size[64];
|
||||
int rv = 0;
|
||||
bool pkg_is_dep;
|
||||
bool pkg_is_dep, first = false;
|
||||
|
||||
assert(props != NULL);
|
||||
|
||||
|
@ -157,6 +158,30 @@ xbps_install_pkg(const char *pkg, bool update)
|
|||
}
|
||||
prop_object_iterator_reset(iter);
|
||||
|
||||
/*
|
||||
* Show the list of packages that will be installed.
|
||||
*/
|
||||
printf("\nThe following new packages will be installed:\n\n");
|
||||
|
||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "pkgname", &pkgname);
|
||||
prop_dictionary_get_cstring_nocopy(obj, "version", &version);
|
||||
cols += strlen(pkgname) + strlen(version) + 4;
|
||||
if (cols <= 80) {
|
||||
if (first == false) {
|
||||
printf(" ");
|
||||
first = true;
|
||||
}
|
||||
printf("%s-%s ", pkgname, version);
|
||||
} else {
|
||||
printf("\n ");
|
||||
cols = strlen(pkgname) + strlen(version) + 4;
|
||||
printf("%s-%s ", pkgname, version);
|
||||
}
|
||||
}
|
||||
prop_object_iterator_reset(iter);
|
||||
printf("\n\n");
|
||||
|
||||
/*
|
||||
* Show total download/installed size for all required packages.
|
||||
*/
|
||||
|
@ -171,7 +196,12 @@ xbps_install_pkg(const char *pkg, bool update)
|
|||
printf("error: humanize_number2 %s\n", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("Total installed size: %s\n", size);
|
||||
printf("Total installed size: %s\n\n", size);
|
||||
|
||||
if (xbps_noyes("Do you want to continue?") == false) {
|
||||
printf("Aborting!\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* Install all packages, the list is already sorted.
|
||||
|
@ -189,7 +219,7 @@ xbps_install_pkg(const char *pkg, bool update)
|
|||
instpkg = xbps_find_pkg_installed_from_plist(pkgname);
|
||||
if (instpkg == NULL) {
|
||||
printf("error: unable to find %s installed "
|
||||
"dict!\n", pkgname, version);
|
||||
"dict!\n", pkgname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue