* Added support inspired by aj for converted rpm packages that create

users/groups in their preinst, and which alien therefore cannot ship the
     files with proper ownerships in the .deb. In this case alien will now
     insert appropriate chown commands into the postinst script of the
     converted package.
   * That only works when converting rpm to deb, not the other way around,
     for now.
   * Removed the cpio directory permissions fixup code, which was probably
     broken, and is obsolete since I get directory perms from the rpm now.
This commit is contained in:
joey
2002-08-25 19:10:56 +00:00
parent 48400e6418
commit ed7a39e3d1
4 changed files with 91 additions and 51 deletions

View File

@@ -703,6 +703,40 @@ sub username {
return $username;
}
=item postinst
Returns the postinst. This may include generated shell code to set owners
and groups from the owninfo field.
=cut
sub postinst {
my $this=shift;
my $owninfo = $this->owninfo;
my $postinst = $this->{postinst};
return $postinst unless ref $owninfo;
# If there is no postinst, let's make one up..
$postinst="#!/bin/sh\n" unless defined $postinst;
my ($firstline, $rest)=split(/\n/, $postinst, 2);
if ($firstline !~ m/^#!\s*\/bin\/sh/) {
print STDERR "warning: unable to add ownership fixup code to postinst as the postinst is not a shell script!\n";
return $postinst;
}
my $permscript="# alien added permissions fixup code\n";
foreach my $file (keys %$owninfo) {
my $quotedfile=$file;
$quotedfile=~s/'/'"'"'/g; # no single quotes in single quotes..
$permscript.="chown '$owninfo->{$file}' '$quotedfile'\n";
}
return "$firstline\n$permscript\n$rest";
}
=cut
=head1 AUTHOR
Joey Hess <joey@kitenet.net>