From bffd564172e46ad738ada30e360f8e4464898273 Mon Sep 17 00:00:00 2001 From: joey Date: Thu, 8 Feb 2001 03:10:41 +0000 Subject: [PATCH] * Munge in #!/bin/sh entries at the top of rpm maintainer scripts that appear to be shell scripts. Closes: #76124 --- Alien/Package/Rpm.pm | 16 +++++++++++++++- debian/changelog | 7 +++++++ debian/control | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index c8beb0f..d835b14 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -395,6 +395,11 @@ debian/slackware scripts can be anything -- perl programs or binary files -- and rpm is limited to only shell scripts, we need to encode the files and add a scrap of shell script to make it unextract and run on the fly. +When setting a value, we do some mangling too. Rpm maitainer scripts +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. + =cut # This helper function deals with all the scripts. @@ -403,6 +408,13 @@ sub _script_helper { my $script=shift; # set + if (@_) { + my $value=shift; + if (length $value and $value !~ m/#!\s*\//) { + $value="#!/bin/sh\n$value"; + } + $this->{$script} = $value; + } $this->{$script} = shift if @_; # get @@ -410,9 +422,11 @@ sub _script_helper { $_=$this->{$script}; return '' unless defined $_; return $_ if m/^\s*$/; + return $_ if m/#!\s*\/bin\/sh/; # looks like a shell script already my $f = pack("u",$_); $f =~ s/%/%%/g; # Rpm expands %S, so escape such things. - return "set -e\n". + return "#!/bin/sh\n". + "set -e\n". "mkdir /tmp/alien.\$\$\n". qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.\$\$/script\n}. $f."__EOF__\n". diff --git a/debian/changelog b/debian/changelog index 7383cba..8fd3ce5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +alien (7.17) unstable; urgency=low + + * Munge in #!/bin/sh entries at the top of rpm maintainer + scripts that appear to be shell scripts. Closes: #76124 + + -- Joey Hess Wed, 7 Feb 2001 18:58:56 -0800 + alien (7.16) unstable; urgency=low * Updated motif patches again. diff --git a/debian/control b/debian/control index 110f0c5..fa6086d 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: admin Priority: optional Build-Depends-Indep: debhelper Maintainer: Joey Hess -Standards-Version: 3.2.1.0 +Standards-Version: 3.5.0.0 Package: alien Architecture: all