#!/usr/bin/perl use strict; use warnings; my $twikiDir=$ARGV[0]; my @plugins = ('NatSkin','NatSkinPlugin', 'RedDotPlugin', 'FlexWebListPlugin', 'BreadCrumbsPlugin', 'FilterPlugin', 'GluePlugin', 'IfDefinedPlugin', 'TwistyPlugin'); my $plugin=""; foreach $plugin(@plugins) { InstallTWikiPlugin($plugin,$twikiDir); } #CopyLeftBarToSideBar($twikiDir); FixTWikiAccessRight($twikiDir); exit 0; sub InstallTWikiPlugin { my ($pluginName, $twikiDir) = @_; `wget http://twiki.org/cgi-bin/viewfile/Plugins/$pluginName?filename=$pluginName.zip`; `mv $pluginName\?filename\=$pluginName.zip $pluginName.zip`; `unzip $pluginName.zip -d $twikiDir`; } sub FixTWikiAccessRight { my ($twikiDir) = @_; #chdir $twikiDir; `find $twikiDir -type d -print -exec chmod -v 755 {} \\;`; `find $twikiDir/data -name '*.txt' -type f -exec chmod -v 660 {} \\;`; `find $twikiDir/data $twikiDir/pub -name '*,v' -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/lib -name '*.pm' -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/locale -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/pub -type f -exec chmod -v 660 {} \\;`; `find $twikiDir/pub/TWiki/WysiwygPlugin/_kupu -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/bin -type f -exec chmod -v 550 {} \\;`; `find $twikiDir/bin/logos -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/templates -type f -exec chmod -v 440 {} \\;`; `find $twikiDir/tools -type f -exec chmod -v 550 {} \\;`; `chmod -v 660 $twikiDir/lib/LocalSite.cfg`; `chmod -v 660 $twikiDir/data/.htpasswd`; `chmod -v 660 $twikiDir/data/mime.types`; `chmod -v 440 $twikiDir/bin/LocalLib.cfg.txt`; `chmod -v 440 $twikiDir/bin/.htaccess.txt`; `chmod -v 440 $twikiDir/pub/_work_areas/.htaccess`; `chmod -v 440 $twikiDir/pub/_work_areas/README`; `chmod -v 440 $twikiDir/AUTHORS $twikiDir/COPYING $twikiDir/COPYRIGHT $twikiDir/index.html $twikiDir/INSTALL.html $twikiDir/LICENSE $twikiDir/pub-htaccess.txt $twikiDir/readme.txt $twikiDir/robots.txt $twikiDir/root-htaccess.txt $twikiDir/subdir-htaccess.txt $twikiDir/TWikiHistory.html $twikiDir/twiki_httpd_conf.txt $twikiDir/TWikiReleaseNotes04x00.html`; `chmod -v 550 $twikiDir/UpgradeTwiki`; } sub CopyLeftBarToSideBar { my ($twikiDir) = @_; my @res=`find $twikiDir/data/Main -name "*LeftBar*" ! -name "WebLeftBar*"`; my $filename=""; foreach $filename(@res) { $filename = trim($filename); if ($filename =~ /(.*)LeftBar(.*)/) { `cp $filename $1SideBar$2`; #print "cp $filename $1SideBar$2\n"; } } } sub trim { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; }