diff options
Diffstat (limited to 'meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch')
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch b/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch index 9f77c6c991..80504ce8b9 100644 --- a/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch +++ b/meta/recipes-devtools/dpkg/dpkg/0003-Our-pre-postinsts-expect-D-to-be-set-when-running-in.patch | |||
@@ -8,30 +8,41 @@ Subject: [PATCH 3/5] Our pre/postinsts expect $D to be set when running in a | |||
8 | Upstream-Status: Inappropriate [OE Specific] | 8 | Upstream-Status: Inappropriate [OE Specific] |
9 | 9 | ||
10 | RP 2011/12/07 | 10 | RP 2011/12/07 |
11 | ALIMON 2016/05/26 | ||
12 | |||
11 | --- | 13 | --- |
12 | src/script.c | 31 ++----------------------------- | 14 | src/script.c | 39 +++------------------------------------ |
13 | 1 file changed, 2 insertions(+), 29 deletions(-) | 15 | 1 file changed, 3 insertions(+), 36 deletions(-) |
14 | 16 | ||
15 | diff --git a/src/script.c b/src/script.c | 17 | diff --git a/src/script.c b/src/script.c |
16 | index a958145..24c49f9 100644 | 18 | index 3c88be8..ce66a86 100644 |
17 | --- a/src/script.c | 19 | --- a/src/script.c |
18 | +++ b/src/script.c | 20 | +++ b/src/script.c |
19 | @@ -100,36 +100,9 @@ maintscript_pre_exec(struct command *cmd) | 21 | @@ -97,43 +97,10 @@ setexecute(const char *path, struct stat *stab) |
20 | size_t instdirl = strlen(instdir); | 22 | static const char * |
21 | 23 | maintscript_pre_exec(struct command *cmd) | |
22 | if (*instdir) { | 24 | { |
25 | - const char *admindir = dpkg_db_get_dir(); | ||
26 | - const char *changedir = fc_script_chrootless ? instdir : "/"; | ||
27 | - size_t instdirl = strlen(instdir); | ||
28 | - | ||
29 | - if (*instdir && !fc_script_chrootless) { | ||
23 | - if (strncmp(admindir, instdir, instdirl) != 0) | 30 | - if (strncmp(admindir, instdir, instdirl) != 0) |
24 | - ohshit(_("admindir must be inside instdir for dpkg to work properly")); | 31 | - ohshit(_("admindir must be inside instdir for dpkg to work properly")); |
25 | - if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0) | 32 | - if (setenv("DPKG_ADMINDIR", admindir + instdirl, 1) < 0) |
26 | - ohshite(_("unable to setenv for subprocesses")); | 33 | - ohshite(_("unable to setenv for subprocesses")); |
34 | - if (setenv("DPKG_ROOT", "", 1) < 0) | ||
35 | - ohshite(_("unable to setenv for subprocesses")); | ||
27 | - | 36 | - |
28 | - if (chroot(instdir)) | 37 | - if (chroot(instdir)) |
29 | - ohshite(_("failed to chroot to '%.250s'"), instdir); | 38 | - ohshite(_("failed to chroot to '%.250s'"), instdir); |
30 | - } | 39 | + if (*instdir) { |
40 | + setenv("D", instdir, 1); | ||
41 | } | ||
31 | - /* Switch to a known good directory to give the maintainer script | 42 | - /* Switch to a known good directory to give the maintainer script |
32 | - * a saner environment, also needed after the chroot(). */ | 43 | - * a saner environment, also needed after the chroot(). */ |
33 | - if (chdir("/")) | 44 | - if (chdir(changedir)) |
34 | - ohshite(_("failed to chdir to '%.255s'"), "/"); | 45 | - ohshite(_("failed to chdir to '%.255s'"), changedir); |
35 | - if (debug_has_flag(dbg_scripts)) { | 46 | - if (debug_has_flag(dbg_scripts)) { |
36 | - struct varbuf args = VARBUF_INIT; | 47 | - struct varbuf args = VARBUF_INIT; |
37 | - const char **argv = cmd->argv; | 48 | - const char **argv = cmd->argv; |
@@ -44,9 +55,8 @@ index a958145..24c49f9 100644 | |||
44 | - debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, | 55 | - debug(dbg_scripts, "fork/exec %s (%s )", cmd->filename, |
45 | - args.buf); | 56 | - args.buf); |
46 | - varbuf_destroy(&args); | 57 | - varbuf_destroy(&args); |
47 | + setenv("D", instdir, 1); | 58 | - } |
48 | } | 59 | - if (!instdirl || fc_script_chrootless) |
49 | - if (!instdirl) | ||
50 | - return cmd->filename; | 60 | - return cmd->filename; |
51 | - | 61 | - |
52 | - assert(strlen(cmd->filename) >= instdirl); | 62 | - assert(strlen(cmd->filename) >= instdirl); |