[interchange-cvs] interchange - jon modified scripts/makecat.PL
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Fri Feb 1 11:01:01 2002
User: jon
Date: 2002-02-01 16:00:55 GMT
Modified: scripts makecat.PL
Log:
Some modifications to allow RPM building as non-root user. (Still works
as root, too.)
Rewrote the mvuid/mvgid section to be clearer, in the process.
Revision Changes Path
2.12 +34 -27 interchange/scripts/makecat.PL
rev 2.12, prev_rev 2.11
Index: makecat.PL
===================================================================
RCS file: /var/cvs/interchange/scripts/makecat.PL,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -u -r2.11 -r2.12
--- makecat.PL 11 Jan 2002 09:45:12 -0000 2.11
+++ makecat.PL 1 Feb 2002 16:00:55 -0000 2.12
@@ -50,9 +50,9 @@
#
# Interchange catalog configurator
#
-# $Id: makecat.PL,v 2.11 2002/01/11 09:45:12 jon Exp $
+# $Id: makecat.PL,v 2.12 2002/02/01 16:00:55 jon Exp $
#
-# Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
+# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -454,7 +454,7 @@
my $isroot = 0;
if ($< == 0) {
- $isroot = 1 unless $Windows;
+ $isroot = 1 unless $Windows or $Conf{relocate};
}
$Conf{catalogname} = $catalog_name;
@@ -1278,34 +1278,41 @@
}
-$mvuid = $Windows ? 'everybody' : (getpwnam($Conf{interchangeuser}))[2];
-unless (defined $mvuid) {
- die "$Conf{interchangeuser} is not a valid user name on this machine.\n";
+if ($Windows) {
+ $mvuid = $catuid = 'everybody';
+ $mvgid = $catgid = 'nogroup';
+}
+elsif ($Conf{relocate}) {
+ $mvuid = $catuid = $mvgid = $catgid = 'nobody';
+}
+else {
+ $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;
}
-# 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";
+ if(! $Conf{permtype} or $Conf{permtype} =~ /^[MUmu]/) {
+ $Conf{catgroup} = getgrgid($catgid);
}
-}
-else {
- $mvgid = $Windows ? 'nogroup' : (getpwnam($Conf{interchangeuser}))[3];
-}
-
-if($Windows) {
- ($catuid,$catgid) = ('everybody', 'nogroup');
-}
-else {
- ($catuid,$catgid) = (getpwnam($Conf{catuser}))[2,3];
- unless (defined $catuid) {
- die "$Conf{catuser} is not a valid user name on this machine.\n";
+ else {
+ $Conf{catgroup} = getgrgid($mvgid);
}
}
@@ -2278,7 +2285,7 @@
=head1 VERSION
-# $Id: makecat.PL,v 2.11 2002/01/11 09:45:12 jon Exp $
+# $Id: makecat.PL,v 2.12 2002/02/01 16:00:55 jon Exp $
=head1 INTRODUCTION
@@ -2665,7 +2672,7 @@
=head1 COPYRIGHT
-Copyright 1995-2001, Red Hat, Inc. All rights reserved except as in the
+Copyright 1995-2002, Red Hat, Inc. All rights reserved except as in the
license.
=cut