diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 77dc8b9..0000000 --- a/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -alien.lsm -alien.spec diff --git a/Alien/Package.pm b/Alien/Package.pm index 7effdc3..0ff5fcd 100644 --- a/Alien/Package.pm +++ b/Alien/Package.pm @@ -138,6 +138,12 @@ ownership/group information for files that cannot be represented on the filesystem. Typically that is because the owners or groups just don't exist yet. It will be set at unpack time. +=item modeinfo + +If set this will be a reference to a hash, with filename as key, that +holds mode information for setuid files that have an entry in owninfo. +It will be set at unpack time. + =back =head1 METHODS diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index dd550fb..78e8eaa 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -709,7 +709,7 @@ sub username { =item postinst Returns the postinst. This may include generated shell code to set owners -and groups from the owninfo field. +and groups from the owninfo field, and update modes from the modeinfo field. =cut @@ -717,6 +717,7 @@ sub postinst { my $this=shift; my $owninfo = $this->owninfo; + my $modeinfo = $this->modeinfo; my $postinst = $this->{postinst}; return $postinst unless ref $owninfo; @@ -730,10 +731,12 @@ sub postinst { } my $permscript="# alien added permissions fixup code\n"; - foreach my $file (keys %$owninfo) { + foreach my $file (sort keys %$owninfo) { my $quotedfile=$file; $quotedfile=~s/'/'"'"'/g; # no single quotes in single quotes.. $permscript.="chown '$owninfo->{$file}' '$quotedfile'\n"; + $permscript.="chmod '$modeinfo->${file}' '$quotedfile'\n" + if (defined $modeinfo->{$file}); } return "$firstline\n$permscript\n$rest"; } diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 4384db2..0833e95 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -195,6 +195,7 @@ sub unpack { # Some permissions setting may have to be postponed until the # postinst. my %owninfo = (); + my %modeinfo = (); open (GETPERMS, 'rpm --queryformat \'[%{FILEMODES} %{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]\' -qp '.$this->filename.' |'); while () { chomp; @@ -215,6 +216,9 @@ sub unpack { } $gid=0; } + if (defined($owninfo{$file}) && ($mode & 07000 > 0)) { + $modeinfo{$file} = $mode; + } next unless -e "$workdir/$file"; # skip broken links if ($> == 0) { $this->do("chown", "$uid:$gid", "$workdir/$file") @@ -224,6 +228,7 @@ sub unpack { || die "failed changing mode of $file to $mode\: $!"; } $this->owninfo(\%owninfo); + $this->modeinfo(\%modeinfo); return 1; } diff --git a/debian/control b/debian/control index bf0436e..bbb3af1 100644 --- a/debian/control +++ b/debian/control @@ -1,9 +1,9 @@ Source: alien Section: admin Priority: optional -Build-Depends-Indep: debhelper (>= 4), dpkg-dev (>= 1.9.0) +Build-Depends: debhelper (>= 4), dpkg-dev (>= 1.9.0) Maintainer: Joey Hess -Standards-Version: 3.6.0 +Standards-Version: 3.6.1.0 Package: alien Architecture: all