[pacman-dev] [PATCH 2/2] pacman: don't run hooks when using --dbonly

morganamilo morganamilo at archlinux.org
Sun Jun 13 12:28:16 UTC 2021


--dbonly is meant to only touch the database and not the actual system.
However hooks still run which can leave files in place or run commands
you may not want.

The hooks being run also means `fakeroot pacman -S --dbpath test/ foo --dbonly`
fails because alpm tries to chroot for hooks which requires real root.
---
 src/pacman/pacman.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 7e810127..f94fd2ea 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -633,6 +633,7 @@ static int parsearg_trans(int opt)
 		case OP_DBONLY:
 			config->flags |= ALPM_TRANS_FLAG_DBONLY;
 			config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET;
+			config->flags |= ALPM_TRANS_FLAG_NOHOOKS;
 			break;
 		case OP_NOPROGRESSBAR:
 			config->noprogressbar = 1;
-- 
2.32.0


More information about the pacman-dev mailing list