* Don't add line about permissions fixup code to postinst if there is not

code to add.
   * Don't assume that just because we know of a user or are root, that files
     can go into the deb owned by that user, and come out right on install.
     Instead, assume that any non-root user will not be on the target system
     the rpm is installed on, and that it might be created in the preinst or
     something, so add permissions fixup code for all such users.
This commit is contained in:
joey
2004-03-25 04:01:40 +00:00
parent 63d14d94e6
commit 85b9e8b042
2 changed files with 4 additions and 2 deletions

View File

@@ -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";

View File

@@ -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";
}