[interchange-cvs] interchange - jon modified scripts/makecat.PL
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Mon Feb 4 10:52:01 2002
User: jon
Date: 2002-02-04 15:51:09 GMT
Modified: scripts Tag: STABLE_4_8-branch makecat.PL
Log:
Allow makecat to build RPMs as non-root user ('relocate' setting) and
take on faith given IC user and group names. (Same patch as was committed
to 4.9.)
Revision Changes Path
No revision
No revision
2.5.2.5 +26 -29 interchange/scripts/makecat.PL
rev 2.5.2.5, prev_rev 2.5.2.4
Index: makecat.PL
===================================================================
RCS file: /var/cvs/interchange/scripts/makecat.PL,v
retrieving revision 2.5.2.4
retrieving revision 2.5.2.5
diff -u -u -r2.5.2.4 -r2.5.2.5
--- makecat.PL 24 Jan 2002 05:07:04 -0000 2.5.2.4
+++ makecat.PL 4 Feb 2002 15:51:08 -0000 2.5.2.5
@@ -50,7 +50,7 @@
#
# Interchange catalog configurator
#
-# $Id: makecat.PL,v 2.5.2.4 2002/01/24 05:07:04 jon Exp $
+# $Id: makecat.PL,v 2.5.2.5 2002/02/04 15:51:08 jon Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -453,7 +453,7 @@
my $isroot = 0;
if ($< == 0) {
- $isroot = 1 unless $Windows;
+ $isroot = 1 unless $Windows or $Conf{relocate};
}
$Conf{catalogname} = $catalog_name;
@@ -1287,39 +1287,36 @@
}
-$mvuid = $Windows ? 'everybody' : (getpwnam($Conf{interchangeuser}))[2];
-unless (defined $mvuid) {
- die "$Conf{interchangeuser} is not a valid user name on this machine.\n";
-}
-
-# Fix supplied by Paul V. Shevtsov
-if($isroot) {
- chown ($mvuid, $mvgid, $Configfile)
- or warn "\nCouldn't set ownership of $Configfile: $!\n";
-}
-
-if ($Conf{interchangegroup}) {
- $mvgid = $Windows ? 'nogroup' : getgrnam($Conf{interchangegroup});
- unless (defined $mvgid) {
- die "$Conf{interchangegroup} is not a valid group name on this machine.\n";
- }
-}
-else {
- $mvgid = $Windows ? 'nogroup' : (getpwnam($Conf{interchangeuser}))[3];
- $Conf{interchangegroup} = $Windows ? 'nogroup' : getgrgid($mvgid)
+if ($Windows) {
+ $mvuid = $catuid = 'everybody';
+ $mvgid = $catgid = 'nogroup';
}
-
-if($Windows) {
- ($catuid,$catgid) = ('everybody', 'nogroup');
+elsif ($Conf{relocate}) {
+ $mvuid = $catuid = $mvgid = $catgid = 'nobody';
}
else {
- ($catuid,$catgid) = (getpwnam($Conf{catuser}))[2,3];
- unless (defined $catuid) {
- die "$Conf{catuser} is not a valid user name on this machine.\n";
+ $mvuid = (getpwnam($Conf{interchangeuser}))[2];
+ die "$Conf{interchangeuser} is not a valid user name on this machine.\n"
+ unless defined $mvuid;
+
+ if ($Conf{interchangegroup}) {
+ $mvgid = getgrnam($Conf{interchangegroup});
+ die "$Conf{interchangegroup} is not a valid group name on this machine.\n"
+ unless defined $mvgid;
+ }
+ else {
+ $mvgid = (getpwnam($Conf{interchangeuser}))[3];
+ $Conf{interchangegroup} = getgrgid($mvgid)
}
+
+ ($catuid, $catgid) = (getpwnam($Conf{catuser}))[2,3];
+ die "$Conf{catuser} is not a valid user name on this machine.\n"
+ unless defined $catuid;
}
if($isroot) {
+ chown ($mvuid, $mvgid, $Configfile)
+ or warn "\nCouldn't set ownership of $Configfile: $!\n";
if(! $Conf{permtype} or $Conf{permtype} =~ /^[MUmu]/) {
$Conf{catgroup} = getgrgid($catgid);
}
@@ -2325,7 +2322,7 @@
=head1 VERSION
-# $Id: makecat.PL,v 2.5.2.4 2002/01/24 05:07:04 jon Exp $
+# $Id: makecat.PL,v 2.5.2.5 2002/02/04 15:51:08 jon Exp $
=head1 INTRODUCTION