Commit 3a1182a8 authored by Leigh Stoller's avatar Leigh Stoller

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.
parent d8587fed
......@@ -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 \
......
......@@ -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 \
......
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -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 $_;
}
......
#
# 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;
#!/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/ ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment