diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-09-06 00:32:11 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-09-06 00:32:11 +0000 |
commit | 926c04e844f231622cfe7d74701a878581125188 (patch) | |
tree | 47745aa67327868debf5fad8ebac4c5c6811e062 | |
parent | 8fd13334af6538ab65273a4a6adb5a8cb3faef17 (diff) |
commit.
* Add the ikiwiki-update-wikilist command.
-rwxr-xr-x | Makefile.PL | 4 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | doc/ikiwiki-update-wikilist.mdwn | 28 | ||||
-rw-r--r-- | doc/usage.mdwn | 1 | ||||
-rwxr-xr-x | ikiwiki-update-wikilist | 48 |
5 files changed, 83 insertions, 3 deletions
diff --git a/Makefile.PL b/Makefile.PL index 741f530a2..130484a7c 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -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 diff --git a/debian/changelog b/debian/changelog index 1f916d865..46cce44de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/ikiwiki-update-wikilist.mdwn b/doc/ikiwiki-update-wikilist.mdwn new file mode 100644 index 000000000..4e87f92e6 --- /dev/null +++ b/doc/ikiwiki-update-wikilist.mdwn @@ -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 diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 3075cb107..4fb91b89b 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -295,6 +295,7 @@ configuration options of their own. # SEE ALSO * [[ikiwiki-mass-rebuild]](8) +* [[ikiwiki-update-wikilist]](1) # AUTHOR diff --git a/ikiwiki-update-wikilist b/ikiwiki-update-wikilist new file mode 100755 index 000000000..0f3f0bcc6 --- /dev/null +++ b/ikiwiki-update-wikilist @@ -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: $!"; |