diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index fd03504..9299901 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -448,6 +448,10 @@ are typically shell scripts, but often lack the leading #!/bin/sh This can confuse dpkg, so add the #!/bin/sh if it looks like there is no shebang magic already in place. +Also, if the rpm is relocatable, the script could refer to +RPM_INSTALL_PREFIX, which is set by rpm at run time. Deal with this by +adding code to the script to set RPM_INSTALL_PREFIX. + =cut # This helper function deals with all the scripts. @@ -457,9 +461,18 @@ sub _script_helper { # set if (@_) { + my $prefixcode=""; + if (defined $this->prefixes) { + $prefixcode="RPM_INSTALL_PREFIX=".$this->prefixes."\n"; + $prefixcode.="export RPM_INSTALL_PREFIX\n"; + } + my $value=shift; if (length $value and $value !~ m/^#!\s*\//) { - $value="#!/bin/sh\n$value"; + $value="#!/bin/sh\n$prefixcode$value"; + } + else { + $value=~s/\n/\n$prefixcode/s; } $this->{$script} = $value; } diff --git a/debian/changelog b/debian/changelog index 4bcf447..b52c6cb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ alien (8.65) UNRELEASED; urgency=low * Fix alien's own spec file, s/Copyright/License/. + * Add support for rpm scripts that use RPM_INSTALL_PREFIX, by setting + RPM_INSTALL_PREFIX as part of the converted script. Closes: #400863 - -- Joey Hess Thu, 14 Dec 2006 17:35:11 -0500 + -- Joey Hess Fri, 15 Dec 2006 13:31:54 -0500 alien (8.64) unstable; urgency=low