diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index 373a2a1..02fdf7a 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -725,6 +725,8 @@ sub postinst { # If there is no postinst, let's make one up.. $postinst="#!/bin/sh\n" unless length $postinst; + return $postinst unless %$owninfo; + 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"; diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index bc02716..144a434 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -202,12 +202,12 @@ sub unpack { my ($mode, $owner, $group, $file) = split(/ /, $_, 4); $mode = $mode & 07777; # remove filetype my $uid = getpwnam($owner); - if (! defined $uid || $> != 0) { + if (! defined $uid || $uid != 0) { $owninfo{$file}=$owner; $uid=0; } my $gid = getgrnam($group); - if (! defined $gid || $> != 0) { + if (! defined $gid || $gid != 0) { if (exists $owninfo{$file}) { $owninfo{$file}.=":$group"; }