blob: 2be3cb5af3c50b510853a5cc07f8efdf6866c845 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From a6f269f879221f2777169c5f7291322afe6b661b Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 17 Jan 2017 14:07:17 +0200
4Subject: [PATCH] When cross-installing, execute package scriptlets without
5 chrooting into destination rootfs
6
7This is triggered only when RPM_NO_CHROOT_FOR_SCRIPTS environment variable is defined.
8Otherwise they will trigger an explosion of failures, obviously.
9
10Upstream-Status: Inappropriate [oe-core specific]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 lib/rpmscript.c | 8 +++++++-
14 1 file changed, 7 insertions(+), 1 deletion(-)
15
16diff --git a/lib/rpmscript.c b/lib/rpmscript.c
17index 98d3f420d..b95b5d606 100644
18--- a/lib/rpmscript.c
19+++ b/lib/rpmscript.c
20@@ -467,7 +467,13 @@ rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
21
22 if (rc != RPMRC_FAIL) {
23 if (script_type & RPMSCRIPTLET_EXEC) {
24- rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, &script->nextFileFunc);
25+ if (getenv("RPM_NO_CHROOT_FOR_SCRIPTS") != NULL) {
26+ rpmChrootOut();
27+ rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, &script->nextFileFunc);
28+ rpmChrootIn();
29+ } else {
30+ rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, &script->nextFileFunc);
31+ }
32 } else {
33 rc = runLuaScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, &script->nextFileFunc);
34 }
35--
362.11.0
37