* Add the ikiwiki-update-wikilist command.
master
joey 2007-09-06 00:32:11 +00:00
parent 8fd13334af
commit 926c04e844
5 changed files with 83 additions and 3 deletions

View File

@ -39,12 +39,13 @@ extra_build: ikiwiki.out
--plugin=haiku --plugin=polygen --plugin=fortune
./mdwn2man ikiwiki 1 doc/usage.mdwn > ikiwiki.man
./mdwn2man ikiwiki-mass-rebuild 8 doc/ikiwiki-mass-rebuild.mdwn > ikiwiki-mass-rebuild.man
./mdwn2man ikiwiki-update-wikilist 1 doc/ikiwiki-update-wikilist.mdwn > ikiwiki-update-wikilist.man
$(MAKE) -C po
if [ "$$PROFILE" = 1 ]; then dprofpp; fi
extra_clean:
rm -rf html doc/.ikiwiki
rm -f ikiwiki.man ikiwiki-mass-rebuild.man ikiwiki.out
rm -f ikiwiki.man ikiwiki-mass-rebuild.man ikiwiki-update-wikilist.man ikiwiki.out
$(MAKE) -C po clean
extra_install:
@ -69,6 +70,7 @@ extra_install:
install -d $(DESTDIR)$(PREFIX)/share/man/man1
install -m 644 ikiwiki.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki.1
install -m 644 ikiwiki-update-wikilist.man $(DESTDIR)$(PREFIX)/share/man/man1/ikiwiki-update-wikilist.1
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install -m 644 ikiwiki-mass-rebuild.man $(DESTDIR)$(PREFIX)/share/man/man8/ikiwiki-mass-rebuild.8

5
debian/changelog vendored
View File

@ -38,9 +38,10 @@ ikiwiki (2.7) UNRELEASED; urgency=low
* table: Text::CSV doesn't return decoded unicode (XS module); decode its
return values.
* Change git test suite to reflect change in log for initial repo creation
commit.
commit.
* Add the ikiwiki-update-wikilist command.
-- Joey Hess <joeyh@debian.org> Wed, 05 Sep 2007 19:43:37 -0400
-- Joey Hess <joeyh@debian.org> Wed, 05 Sep 2007 20:07:24 -0400
ikiwiki (2.6.1) unstable; urgency=low

View File

@ -0,0 +1,28 @@
# NAME
ikiwiki-update-wikilist - add or remove user from /etc/ikiwiki/wikilist
# SYNOPSIS
ikiwiki-update-wikilist
# DESCRIPTION
`ikiwiki-update-wikilist` is designed to be made suid root, but not installed
suid by default. If made suid, it allows users to add or remove their names
from the `/etc/ikiwiki/wikilist` file. If a user's name is not in the file,
it will be added; if the name is already present, it will be removed.
If your name is in `/etc/ikiwiki/wikilist`, the [[ikiwiki-mass-rebuild]](8)
command will look for a ~/.ikiwiki/wikilist file, and rebuild the wikis listed
in that file.
# OPTIONS
None.
# AUTHOR
Joey Hess <joey@ikiwiki.info>
Warning: this page is automatically made into ikiwiki-update-wikilist's man page, edit with care

View File

@ -295,6 +295,7 @@ configuration options of their own.
# SEE ALSO
* [[ikiwiki-mass-rebuild]](8)
* [[ikiwiki-update-wikilist]](1)
# AUTHOR

View File

@ -0,0 +1,48 @@
#!/usr/bin/perl -t
# Add a user to the system wide wikilist.
# This script can safely be made suid.
use warnings;
use strict;
use English;
my $username=getpwuid($REAL_USER_ID);
if (! defined $username || ! length $username) {
die "unable to determine user name for UID $REAL_USER_ID\n";
}
my $wikilist="/etc/ikiwiki/wikilist";
if (! -e $wikilist) {
die "$wikilist does not exist\n";
}
my $removed=0;
my @lines;
open (my $list, "<$wikilist") || die "read $wikilist: $!";
while (<$list>) {
chomp;
if (/^\s*([^\s]+)\s*$/) {
my $user=$1;
if ($user eq $username) {
$removed=1;
}
else {
push @lines, $_;
}
}
else {
push @lines, $_;
}
}
close $list || die "error reading $list: $!";
open ($list, ">$wikilist") || die "write $wikilist: $!";
foreach (@lines) {
print $list "$_\n";
}
if ($removed) {
print "removed user $username from $wikilist\n";
}
else {
print $list "$username\n";
print "added user $username to $wikilist\n";
}
close $list || die "error writing $list: $!";