mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
* 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:
@@ -725,6 +725,8 @@ sub postinst {
|
|||||||
# If there is no postinst, let's make one up..
|
# If there is no postinst, let's make one up..
|
||||||
$postinst="#!/bin/sh\n" unless length $postinst;
|
$postinst="#!/bin/sh\n" unless length $postinst;
|
||||||
|
|
||||||
|
return $postinst unless %$owninfo;
|
||||||
|
|
||||||
my ($firstline, $rest)=split(/\n/, $postinst, 2);
|
my ($firstline, $rest)=split(/\n/, $postinst, 2);
|
||||||
if ($firstline !~ m/^#!\s*\/bin\/sh/) {
|
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";
|
print STDERR "warning: unable to add ownership fixup code to postinst as the postinst is not a shell script!\n";
|
||||||
|
|||||||
@@ -202,12 +202,12 @@ sub unpack {
|
|||||||
my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
|
my ($mode, $owner, $group, $file) = split(/ /, $_, 4);
|
||||||
$mode = $mode & 07777; # remove filetype
|
$mode = $mode & 07777; # remove filetype
|
||||||
my $uid = getpwnam($owner);
|
my $uid = getpwnam($owner);
|
||||||
if (! defined $uid || $> != 0) {
|
if (! defined $uid || $uid != 0) {
|
||||||
$owninfo{$file}=$owner;
|
$owninfo{$file}=$owner;
|
||||||
$uid=0;
|
$uid=0;
|
||||||
}
|
}
|
||||||
my $gid = getgrnam($group);
|
my $gid = getgrnam($group);
|
||||||
if (! defined $gid || $> != 0) {
|
if (! defined $gid || $gid != 0) {
|
||||||
if (exists $owninfo{$file}) {
|
if (exists $owninfo{$file}) {
|
||||||
$owninfo{$file}.=":$group";
|
$owninfo{$file}.=":$group";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user