From 3a1182a89b3d7f85b641f839e371dce24496ea04 Mon Sep 17 00:00:00 2001 From: "Leigh B. Stoller" Date: Tue, 7 Mar 2006 00:15:45 +0000 Subject: [PATCH] Commit installation support for TWiki. Note that this is for the new version of TWiki, which will not run on ops until it is updated. --- configure | 2 +- configure.in | 2 +- defs-elabinelab | 4 +- install/ops-install.in | 70 +++++++++++++++++++++++++++--- install/ports/emulab-ops/Makefile | 4 +- install/ports/emulab-php4/Makefile | 5 +++ tmcd/common/config/rc.mkelab | 9 ++++ wiki/LocalSite.cfg.in | 17 ++++++++ wiki/wikiproxy.in | 24 ++++++++-- 9 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 wiki/LocalSite.cfg.in diff --git a/configure b/configure index 1bd9cf341..dc0eea7a2 100755 --- a/configure +++ b/configure @@ -2385,7 +2385,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ robots/tracker/GNUmakefile \ robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord \ wiki/GNUmakefile wiki/addwikiuser wiki/wikiproxy \ - wiki/usertemplate wiki/webhometemplate \ + wiki/usertemplate wiki/webhometemplate wiki/LocalSite.cfg \ wiki/delwikiuser wiki/setwikigroups wiki/addwikiproj \ bugdb/GNUmakefile bugdb/bugdbproxy \ collab/GNUmakefile \ diff --git a/configure.in b/configure.in index 19dd691bf..e33187431 100755 --- a/configure.in +++ b/configure.in @@ -823,7 +823,7 @@ outfiles="$outfiles Makeconf GNUmakefile \ robots/tracker/GNUmakefile \ robots/mezzanine/mezzcal/GNUmakefile robots/robomonitord \ wiki/GNUmakefile wiki/addwikiuser wiki/wikiproxy \ - wiki/usertemplate wiki/webhometemplate \ + wiki/usertemplate wiki/webhometemplate wiki/LocalSite.cfg \ wiki/delwikiuser wiki/setwikigroups wiki/addwikiproj \ bugdb/GNUmakefile bugdb/bugdbproxy \ collab/GNUmakefile \ diff --git a/defs-elabinelab b/defs-elabinelab index cfa9cf84a..9abc7bdd8 100644 --- a/defs-elabinelab +++ b/defs-elabinelab @@ -31,8 +31,8 @@ WWWHOST=changeme TBMAINSITE=0 THISHOMEBASE=changeme PLABSUPPORT=0 -WIKISUPPORT=0 -BUGDBSUPPORT=0 +WIKISUPPORT=changeme +BUGDBSUPPORT=changeme MAILMANSUPPORT=changeme WINSUPPORT=0 SFSSUPPORT=0 diff --git a/install/ops-install.in b/install/ops-install.in index 34a00e4c6..36ff84fee 100644 --- a/install/ops-install.in +++ b/install/ops-install.in @@ -40,6 +40,7 @@ my $WINSUPPORT = @WINSUPPORT@; my $MAILMANSUPPORT = @MAILMANSUPPORT@; my $CVSSUPPORT = @CVSSUPPORT@; my $BUGDBSUPPORT= @BUGDBSUPPORT@; +my $WIKISUPPORT = @WIKISUPPORT@; my $QUOTA_FSLIST= '@FS_WITH_QUOTAS@'; my $LOGDIR = "$PREFIX/log"; my $ETCDIR = "$PREFIX/etc"; @@ -314,7 +315,7 @@ Phase "ports", "Installing ports", sub { }; if ($MAILMANSUPPORT) { Phase "mailman", "Installing Mailman package", sub { - if (!ExecQuiet("$PKG_INFO -x -e mailman")) { + if (!ExecQuiet("$PKG_INFO -x -E mailman")) { PhaseSkip("Mailman package already installed"); } if (!$packagedir) { @@ -334,7 +335,7 @@ Phase "ports", "Installing ports", sub { PhaseSkip("cvsd not supported on ops") if ($FBSD_VERSION < 6); - if (!ExecQuiet("$PKG_INFO -x -e cvsd")) { + if (!ExecQuiet("$PKG_INFO -x -E cvsd")) { PhaseSkip("cvsd package already installed"); } if (!$packagedir) { @@ -354,7 +355,7 @@ Phase "ports", "Installing ports", sub { PhaseSkip("flyspray not supported on ops") if ($FBSD_VERSION < 6); - if (!ExecQuiet("$PKG_INFO -x -e adodb")) { + if (!ExecQuiet("$PKG_INFO -x -E adodb")) { PhaseSkip("adodb package already installed"); } if (!$packagedir) { @@ -791,8 +792,14 @@ Phase "cron", "Adding cron jobs", sub { PhaseSkip("No filesystem quotas"); } DoneIfEdited($CRONTAB); - AppendToFileFatal($CRONTAB, - "0 \t6\t*\t*\t*\troot\t$PREFIX/sbin/quotamail"); + + my @cronlist = ("0 \t6\t*\t*\t*\troot\t$PREFIX/sbin/quotamail"); + if ($WIKISUPPORT) { + push(@cronlist, + "*/15 \t*\t*\t*\t*\troot\t(cd /usr/local/www/data/twiki/bin;". + " ./mailnotify -q >> /var/tmp/mailnotify.log 2>&1)"); + } + AppendToFileFatal($CRONTAB, @cronlist); }; Phase "cronhup", "HUPing cron", sub { if (PhaseWasSkipped("crontab")) { PhaseSkip("No new crontab"); } @@ -1246,6 +1253,59 @@ if ($BUGDBSUPPORT) { }; } +if ($WIKISUPPORT) { + my $WIKIDIR = "/usr/local/www/data/twiki"; + my $WIKICONF = "LocalSite.cfg"; + my $WIKIURL = "http://www.emulab.net/downloads/twiki-4.1.tgz"; + my $localtarfile = "/tmp/twiki.tgz"; + my $CGISESSDIR = "/var/db/cgisess"; + my $WIKI_LOGDIR = "$LOGDIR/twiki"; + + Phase "TWiki", "Installing TWiki", sub { + PhaseSkip("TWiki not supported on ops") + if ($FBSD_VERSION < 6); + + Phase "fetching", "Fetching TWiki distribution", sub { + DoneIfExists($localtarfile); + FetchFileFatal($WIKIURL, $localtarfile); + }; + + if (! -e "$CGISESSDIR") { + mkdir("$CGISESSDIR", 0770) or + PhaseFail("Unable to make $CGISESSDIR : $!"); + } + ExecQuietFatal("$CHOWN nobody:wheel $CGISESSDIR"); + + Phase "unpacking", "Unpacking TWiki distribution", sub { + if (! -e "$WIKIDIR") { + mkdir("$WIKIDIR", 0770) or + PhaseFail("Unable to make $WIKIDIR : $!"); + } + ExecQuietFatal("$CHMOD 770 $WIKIDIR"); + + PhaseSkip("Flyspray already unpacked") + if (-e "$WIKIDIR/data"); + ExecQuietFatal("$TAR zxf $localtarfile -C $WIKIDIR"); + }; + ExecQuietFatal("$CHOWN -R nobody:tbadmin $WIKIDIR"); + + Phase "logdir", "Creating TWiki log directory", sub { + DoneIfExists($WIKI_LOGDIR); + mkdir $WIKI_LOGDIR, 0775 or + PhaseFail("Unable to create $WIKI_LOGDIR : $!"); + + ExecQuietFatal("$CHOWN nobody:tbadmin $WIKI_LOGDIR"); + ExecQuietFatal("$CHMOD 770 $WIKI_LOGDIR"); + }; + + Phase "config", "Configuring TWiki", sub { + # Must overwrite the distribution version. + ExecQuietFatal("$CP -f $TOP_OBJDIR/wiki/$WIKICONF ". + " $WIKIDIR/lib/$WIKICONF"); + }; + }; +} + exit(0) if ($ELABINELAB); diff --git a/install/ports/emulab-ops/Makefile b/install/ports/emulab-ops/Makefile index c2ccd630c..9d2b92227 100644 --- a/install/ports/emulab-ops/Makefile +++ b/install/ports/emulab-ops/Makefile @@ -81,6 +81,7 @@ RUN_DEPENDS+= \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-Mysql \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/XML/Parser:${PORTSDIR}/textproc/p5-XML-Parser \ ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/XML/Simple.pm:${PORTSDIR}/textproc/p5-XML-Simple \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/CGI/Session.pm:${PORTSDIR}/www/p5-CGI-Session \ curl:${PORTSDIR}/ftp/curl .else RUN_DEPENDS+= smbd:${PORTSDIR}/net/samba3 @@ -88,7 +89,8 @@ RUN_DEPENDS+= smbd:${PORTSDIR}/net/samba3 .if ${OSMAJOR} >= 6 RUN_DEPENDS+= ${LOCALBASE}/sbin/cvsd:${PORTSDIR}/devel/cvsd \ - ${LOCALBASE}/share/adodb/adodb.inc.php:${PORTSDIR}/databases/adodb + ${LOCALBASE}/share/adodb/adodb.inc.php:${PORTSDIR}/databases/adodb \ + ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/HTML/Parser.pm:${PORTSDIR}/www/p5-HTML-Parser .endif NO_BUILD= yes diff --git a/install/ports/emulab-php4/Makefile b/install/ports/emulab-php4/Makefile index 1e12e45cf..b9df6bebd 100644 --- a/install/ports/emulab-php4/Makefile +++ b/install/ports/emulab-php4/Makefile @@ -14,6 +14,11 @@ WITH_GD=yes WITH_MCRYPT=yes WITH_MYSQL=yes WITH_XML=yes +# Additions for mediawiki +#WITH_ICONV=yes +#WITH_IMAGICK=yes +#WITH_READLINE=yes +#WITH_MBSTRING=yes # # For the PHP ports, so they will depend on the actual version of apache we're diff --git a/tmcd/common/config/rc.mkelab b/tmcd/common/config/rc.mkelab index 8940de366..5127d0f04 100755 --- a/tmcd/common/config/rc.mkelab +++ b/tmcd/common/config/rc.mkelab @@ -1501,6 +1501,15 @@ sub CreateDefsFile($) } last SWITCH; }; + /^WIKISUPPORT$/ && do { + if ($FBSD_VERSION == 6) { + print OUTDEFS "WIKISUPPORT=1\n"; + } + else { + print OUTDEFS "WIKISUPPORT=0\n"; + } + last SWITCH; + }; print OUTDEFS $_; } diff --git a/wiki/LocalSite.cfg.in b/wiki/LocalSite.cfg.in new file mode 100644 index 000000000..37767c6e1 --- /dev/null +++ b/wiki/LocalSite.cfg.in @@ -0,0 +1,17 @@ +# +# This file autogenerated by the Emulab installation procedure. +# + +$cfg{DefaultUrlHost} = 'https://@USERNODE@'; +$cfg{ScriptUrlPath} = '/twiki/bin'; +$cfg{PubUrlPath} = '/twiki/pub'; +$cfg{PubDir} = '/usr/local/www/data/twiki/pub'; +$cfg{TemplateDir} = '/usr/local/www/data/twiki/templates'; +$cfg{DataDir} = '/usr/local/www/data/twiki/data'; +$cfg{LogDir} = '@prefix@/log/twiki'; +$cfg{Sessions}{Dir} = '/var/db/cgisess'; +$cfg{LoginManager} = 'TWiki::Client::EmulabTemplateLogin'; +$cfg{Htpasswd}{Encoding} = 'crypt'; +$cfg{MapUserToWikiName} = $FALSE; + +1; diff --git a/wiki/wikiproxy.in b/wiki/wikiproxy.in index ed5239f46..442548115 100644 --- a/wiki/wikiproxy.in +++ b/wiki/wikiproxy.in @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # # EMULAB-COPYRIGHT -# Copyright (c) 2005 University of Utah and the Flux Group. +# Copyright (c) 2005, 2006 University of Utah and the Flux Group. # All rights reserved. # use English; @@ -44,6 +44,7 @@ my $COOKIEDIR = "/var/db/cgisess"; my $WIKIUSER = "nobody"; my $WIKIGROUP = "nobody"; my $CI = "ci"; +my $TAR = "tar"; # # Turn off line buffering on output @@ -86,6 +87,15 @@ if ($UID != 0) { use lib "@prefix@/lib"; use libtestbed; +# Version of FreeBSD. +my $FBSD_VERSION = 4; +if (`uname -r` =~ /^(\d)/) { + $FBSD_VERSION = $1; +} +else { + die("Could not determine what version of FreeBSD you are running!\n"); +} + # # Parse command arguments. Once we return from getopts, all that should be # left are the required arguments. @@ -419,11 +429,17 @@ sub AddWikiProject(@) print "Creating ${WIKIDATADIR}/${wikiname}\n" if ($debug); + mkdir("${WIKIDATADIR}/${wikiname}", 0775) or + fatal("Could not mkdir $WIKIDATADIR/$wikiname!"); + + system("chown ${WIKIUSER}:${WIKIGROUP} $WIKIDATADIR/$wikiname") == 0 + or fatal("Could not chown $WIKIDATADIR/$wikiname!"); + # # Copy the _default directory to the new WEB name. This "creates" # the new wiki web. # - system("/usr/site/bin/hier cp _default $wikiname") == 0 + system("$TAR cf - -C _default . | $TAR xf - -C $wikiname") == 0 or fatal("Could not copy _default to $wikiname"); system("cp -p ${HOMETEMPLATE} ${wikiname}/WebHome.txt") == 0 @@ -863,7 +879,9 @@ sub CI($$) { system("chown ${WIKIUSER}:${WIKIGROUP} $file") == 0 or fatal("Could not chown $file to ${WIKIUSER}:${WIKIGROUP}"); - my $cmd = "sudo -u nobody ci -l '-mRevision by wikiproxy:\n$comment'". + my $locking = ($FBSD_VERSION == 4 ? "-l" : "-u"); + + my $cmd = "sudo -u nobody ci -u '-mRevision by wikiproxy:\n$comment'". " '-t-Revision by wikiproxy' $file 2>&1"; my $output = `$cmd`; if ($? && $output =~ /no lock set by/ ) { -- GitLab