summaryrefslogtreecommitdiff
path: root/ikiwiki-mass-rebuild
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-14 09:27:11 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-14 09:27:11 -0500
commitcb80809aec56e1b6f0194f3d6f778fc8db3c7783 (patch)
tree9153eb779c632d7b99d5702202ec8dca4707c5b2 /ikiwiki-mass-rebuild
parentebac5236869862d7f7e776402212f6b9731b326a (diff)
* Add wrappergroup config option, which can be used to cause wrappers
to be created owned by some group other than the default. Useful then there's a shared repository with access controlled by a group, to let ikiwiki run setgid to that group. * ikiwiki-mass-rebuild: Run build with the user in all their groups.
Diffstat (limited to 'ikiwiki-mass-rebuild')
-rwxr-xr-xikiwiki-mass-rebuild21
1 files changed, 19 insertions, 2 deletions
diff --git a/ikiwiki-mass-rebuild b/ikiwiki-mass-rebuild
index 1ec90b3c0..710db4eac 100755
--- a/ikiwiki-mass-rebuild
+++ b/ikiwiki-mass-rebuild
@@ -2,6 +2,19 @@
use warnings;
use strict;
+sub supplemental_groups {
+ my $user=shift;
+
+ my @list;
+ while (my @fields=getgrent()) {
+ if (grep { $_ eq $user } split(' ', $fields[3])) {
+ push @list, $fields[2];
+ }
+ }
+
+ return @list;
+}
+
sub processline {
my $user=shift;
my $setup=shift;
@@ -20,11 +33,15 @@ sub processline {
defined(my $pid = fork) or die "Can’t fork: $!";
if (! $pid) {
my ($uuid, $ugid) = (getpwnam($user))[2, 3];
- $)="$ugid $ugid";
+ my $grouplist=join(" ", $ugid, $ugid, supplemental_groups($user));
+ $)=$grouplist;
+ if ($!) {
+ die "failed to set egid $grouplist";
+ }
$(=$ugid;
$<=$uuid;
$>=$uuid;
- if ($< != $uuid || $> != $uuid || $( != $ugid || $) ne "$ugid $ugid") {
+ if ($< != $uuid || $> != $uuid || $( != $ugid) {
die "failed to drop permissions to $user";
}
%ENV=(