Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 24229971492515b64c81e8c6392e5dfbdc22b44c Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Wed, 26 Aug 2015 16:25:45 +0300 |
| 4 | Subject: [PATCH 3/5] Our pre/postinsts expect $D to be set when running in a |
| 5 | sysroot and don't expect a chroot. This matches up our system expectations |
| 6 | with what dpkg does. |
| 7 | |
| 8 | Upstream-Status: Inappropriate [OE Specific] |
| 9 | |
| 10 | RP 2011/12/07 |
| 11 | --- |
| 12 | src/script.c | 31 ++----------------------------- |
| 13 | 1 file changed, 2 insertions(+), 29 deletions(-) |
| 14 | |
| 15 | diff --git a/src/script.c b/src/script.c |
| 16 | index a958145..24c49f9 100644 |
| 17 | --- a/src/script.c |
| 18 | +++ b/src/script.c |
| 19 | @@ -100,36 +100,9 @@ maintscript_pre_exec(struct command *cmd) |
| 20 | size_t instdirl = strlen(instdir); |
| 21 | |
| 22 | if (*instdir) { |
| 23 | - if (strncmp(admindir, instdir, instdirl) != 0) |
| 24 | - ohshit(_("admindir must be inside instdir for dpkg to work properly")); |
| 25 | - if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0) |
| 26 | - ohshite(_("unable to setenv for subprocesses")); |
| 27 | - |
| 28 | - if (chroot(instdir)) |
| 29 | - ohshite(_("failed to chroot to '%.250s'"), instdir); |
| 30 | - } |
| 31 | - /* Switch to a known good directory to give the maintainer script |
| 32 | - * a saner environment, also needed after the chroot(). */ |
| 33 | - if (chdir("/")) |
| 34 | - ohshite(_("failed to chdir to '%.255s'"), "/"); |
| 35 | - if (debug_has_flag(dbg_scripts)) { |
| 36 | - struct varbuf args = VARBUF_INIT; |
| 37 | - const char **argv = cmd->argv; |
| 38 | - |
| 39 | - while (*++argv) { |
| 40 | - varbuf_add_char(&args, ' '); |
| 41 | - varbuf_add_str(&args, *argv); |
| 42 | - } |
| 43 | - varbuf_end_str(&args); |
| 44 | - debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, |
| 45 | - args.buf); |
| 46 | - varbuf_destroy(&args); |
| 47 | + setenv("D", instdir, 1); |
| 48 | } |
| 49 | - if (!instdirl) |
| 50 | - return cmd->filename; |
| 51 | - |
| 52 | - assert(strlen(cmd->filename) >= instdirl); |
| 53 | - return cmd->filename + instdirl; |
| 54 | + return cmd->filename; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | -- |
| 59 | 2.1.4 |
| 60 | |