lib: with XBPS_FLAG_INSTALL_AUTO only mark new installs as automatic

Closes: https://github.com/void-linux/xbps/issues/556
This commit is contained in:
Duncan Overbruck
2023-05-30 21:16:28 +02:00
parent c1176447f3
commit 825f1f30f9
3 changed files with 123 additions and 13 deletions

View File

@ -62,6 +62,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
xbps_trans_type_t ttype;
const char *repoloc, *repopkgver, *instpkgver, *pkgname;
char buf[XBPS_NAME_SIZE] = {0};
bool autoinst = false;
int rv = 0;
assert(pkg != NULL);
@ -208,7 +209,13 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
return EINVAL;
}
if (!xbps_transaction_store(xhp, pkgs, pkg_repod, false)) {
/*
* Set automatic-install to true if it was requested and this is a new install.
*/
if (ttype == XBPS_TRANS_INSTALL)
autoinst = xhp->flags & XBPS_FLAG_INSTALL_AUTO;
if (!xbps_transaction_store(xhp, pkgs, pkg_repod, autoinst)) {
return EINVAL;
}