* Munge in #!/bin/sh entries at the top of rpm maintainer

scripts that appear to be shell scripts. Closes: #76124
This commit is contained in:
joey
2001-02-08 03:10:41 +00:00
parent 245b3d73a8
commit bffd564172
3 changed files with 23 additions and 2 deletions

View File

@@ -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 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. 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 =cut
# This helper function deals with all the scripts. # This helper function deals with all the scripts.
@@ -403,6 +408,13 @@ sub _script_helper {
my $script=shift; my $script=shift;
# set # set
if (@_) {
my $value=shift;
if (length $value and $value !~ m/#!\s*\//) {
$value="#!/bin/sh\n$value";
}
$this->{$script} = $value;
}
$this->{$script} = shift if @_; $this->{$script} = shift if @_;
# get # get
@@ -410,9 +422,11 @@ sub _script_helper {
$_=$this->{$script}; $_=$this->{$script};
return '' unless defined $_; return '' unless defined $_;
return $_ if m/^\s*$/; return $_ if m/^\s*$/;
return $_ if m/#!\s*\/bin\/sh/; # looks like a shell script already
my $f = pack("u",$_); my $f = pack("u",$_);
$f =~ s/%/%%/g; # Rpm expands %S, so escape such things. $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". "mkdir /tmp/alien.\$\$\n".
qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.\$\$/script\n}. qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.\$\$/script\n}.
$f."__EOF__\n". $f."__EOF__\n".

7
debian/changelog vendored
View File

@@ -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 <joeyh@debian.org> Wed, 7 Feb 2001 18:58:56 -0800
alien (7.16) unstable; urgency=low alien (7.16) unstable; urgency=low
* Updated motif patches again. * Updated motif patches again.

2
debian/control vendored
View File

@@ -3,7 +3,7 @@ Section: admin
Priority: optional Priority: optional
Build-Depends-Indep: debhelper Build-Depends-Indep: debhelper
Maintainer: Joey Hess <joeyh@debian.org> Maintainer: Joey Hess <joeyh@debian.org>
Standards-Version: 3.2.1.0 Standards-Version: 3.5.0.0
Package: alien Package: alien
Architecture: all Architecture: all