1.1 --- a/librazor/rpm.c Wed Apr 22 15:09:17 2009 +0100
1.2 +++ b/librazor/rpm.c Wed Jun 03 08:26:09 2009 +0100
1.3 @@ -841,18 +841,43 @@
1.4 run_script(struct installer *installer,
1.5 unsigned int program_tag, unsigned int script_tag)
1.6 {
1.7 - int retval;
1.8 - const char *script = NULL, *program = NULL;
1.9 + int i, retval;
1.10 + struct razor_rpm *rpm = installer->rpm;
1.11 + const char *script = NULL, *program = NULL, *prefix;
1.12 + char buf[32], *p;
1.13 + struct array prefix_pool;
1.14
1.15 - program = razor_rpm_get_indirect(installer->rpm, program_tag, NULL);
1.16 - script = razor_rpm_get_indirect(installer->rpm, script_tag, NULL);
1.17 + program = razor_rpm_get_indirect(rpm, program_tag, NULL);
1.18 + script = razor_rpm_get_indirect(rpm, script_tag, NULL);
1.19 if (program == NULL && script == NULL)
1.20 - retval = 0;
1.21 - else if (strcmp(program, "<lua>") == 0)
1.22 + return 0;
1.23 +
1.24 + if (rpm->relocations) {
1.25 + array_init(&prefix_pool);
1.26 + for(i = 0; i < rpm->n_prefixes; i++) {
1.27 + prefix = razor_relocations_apply(rpm->relocations,
1.28 + rpm->prefixes[i]);
1.29 + sprintf(buf, "RPM_INSTALL_PREFIX%d", i);
1.30 + p = array_add(&prefix_pool,
1.31 + strlen(buf) + strlen(prefix) + 2);
1.32 + sprintf(p, "%s=%s", buf, prefix);
1.33 + putenv(p);
1.34 + }
1.35 + }
1.36 +
1.37 + if (strcmp(program, "<lua>") == 0)
1.38 retval = run_script_lua(installer->root, script_tag, script);
1.39 else
1.40 retval = run_script_external(installer->root, program, script);
1.41
1.42 + if (rpm->relocations) {
1.43 + for(i = 0; i < rpm->n_prefixes; i++) {
1.44 + sprintf(buf, "RPM_INSTALL_PREFIX%d=", i);
1.45 + putenv(buf);
1.46 + }
1.47 + array_release(&prefix_pool);
1.48 + }
1.49 +
1.50 return retval;
1.51 }
1.52