2 # Add a user to the system wide wikilist.
3 # This script can safely be made suid.
8 my $username=getpwuid($REAL_USER_ID);
9 if (! defined $username || ! length $username) {
10 die "unable to determine user name for UID $REAL_USER_ID\n";
13 my $wikilist="/etc/ikiwiki/wikilist";
15 die "$wikilist does not exist\n";
20 open (my $list, "<$wikilist") || die "read $wikilist: $!";
23 if (/^\s*([^\s]+)\s*$/) {
25 if ($user eq $username) {
36 close $list || die "error reading $list: $!";
37 open ($list, ">$wikilist") || die "write $wikilist: $!";
42 print "removed user $username from $wikilist\n";
45 print $list "$username\n";
46 print "added user $username to $wikilist\n";
48 close $list || die "error writing $list: $!";