mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
* 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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user