diff -r c9c90315ea24 -r 66ec30bde5e5 librazor/rpm.c --- a/librazor/rpm.c Wed Apr 22 15:09:17 2009 +0100 +++ b/librazor/rpm.c Sat May 09 21:30:22 2009 +0100 @@ -841,18 +841,43 @@ run_script(struct installer *installer, unsigned int program_tag, unsigned int script_tag) { - int retval; - const char *script = NULL, *program = NULL; + int i, retval; + struct razor_rpm *rpm = installer->rpm; + const char *script = NULL, *program = NULL, *prefix; + char buf[32], *p; + struct array prefix_pool; - program = razor_rpm_get_indirect(installer->rpm, program_tag, NULL); - script = razor_rpm_get_indirect(installer->rpm, script_tag, NULL); + program = razor_rpm_get_indirect(rpm, program_tag, NULL); + script = razor_rpm_get_indirect(rpm, script_tag, NULL); if (program == NULL && script == NULL) - retval = 0; - else if (strcmp(program, "") == 0) + return 0; + + if (rpm->relocations) { + array_init(&prefix_pool); + for(i = 0; i < rpm->n_prefixes; i++) { + prefix = razor_relocations_apply(rpm->relocations, + rpm->prefixes[i]); + sprintf(buf, "RPM_INSTALL_PREFIX%d", i); + p = array_add(&prefix_pool, + strlen(buf) + strlen(prefix) + 2); + sprintf(p, "%s=%s", buf, prefix); + putenv(p); + } + } + + if (strcmp(program, "") == 0) retval = run_script_lua(installer->root, script_tag, script); else retval = run_script_external(installer->root, program, script); + if (rpm->relocations) { + for(i = 0; i < rpm->n_prefixes; i++) { + sprintf(buf, "RPM_INSTALL_PREFIX%d=", i); + putenv(buf); + } + array_release(&prefix_pool); + } + return retval; }