diff --git a/actions/ikiwiki b/actions/ikiwiki
index 868913af6..e03001772 100755
--- a/actions/ikiwiki
+++ b/actions/ikiwiki
@@ -26,93 +26,12 @@ import shutil
import subprocess
-CONFIG_ENABLE = '/etc/apache2/conf-enabled/ikiwiki.conf'
-CONFIG_FILE = '/etc/apache2/conf-available/ikiwiki.conf'
+CONFIG_ENABLE = '/etc/apache2/conf-enabled/ikiwiki-plinth.conf'
SETUP_WIKI = '/etc/ikiwiki/plinth-wiki.setup'
SETUP_BLOG = '/etc/ikiwiki/plinth-blog.setup'
SITE_PATH = '/var/www/ikiwiki'
WIKI_PATH = '/var/lib/ikiwiki'
-apache_cgi_configuration = '''
-Alias /ikiwiki /var/www/ikiwiki
-AddHandler cgi-script .cgi
-
-
- Options +ExecCGI
-
-'''
-
-ikiwiki_setup_automator = '''
-#!/usr/bin/perl
-# Ikiwiki setup automator for Plinth.
-
-require IkiWiki::Setup::Automator;
-
-our $wikiname=$ARGV[0];
-our $admin=$ARGV[1];
-if (($wikiname eq "") || ($admin eq "")) {
- print "Usage: ikiwiki -setup /etc/ikiwiki/plinth-wiki.setup wiki_name admin_name";
- exit;
-}
-
-our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
-
-IkiWiki::Setup::Automator->import(
- wikiname => $wikiname,
- adminuser => [$admin],
- rcs => "git",
- srcdir => "/var/lib/ikiwiki/$wikiname_short",
- destdir => "/var/www/ikiwiki/$wikiname_short",
- repository => "/var/lib/ikiwiki/$wikiname_short.git",
- dumpsetup => "/var/lib/ikiwiki/$wikiname_short.setup",
- url => "/ikiwiki/$wikiname_short",
- cgiurl => "/ikiwiki/$wikiname_short/ikiwiki.cgi",
- cgi_wrapper => "/var/www/ikiwiki/$wikiname_short/ikiwiki.cgi",
- add_plugins => [qw{goodstuff websetup httpauth}],
- rss => 1,
- atom => 1,
- syslog => 1,
-)
-'''
-
-ikiwiki_setup_automator_blog = '''
-#!/usr/bin/perl
-# Ikiwiki setup automator for Plinth (blog version).
-
-require IkiWiki::Setup::Automator;
-
-our $wikiname=$ARGV[0];
-our $admin=$ARGV[1];
-if (($wikiname eq "") || ($admin eq "")) {
- print "Usage: ikiwiki -setup /etc/ikiwiki/plinth-blog.setup blog_name admin_name";
- exit;
-}
-
-our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
-
-IkiWiki::Setup::Automator->import(
- wikiname => $wikiname,
- adminuser => [$admin],
- rcs => "git",
- srcdir => "/var/lib/ikiwiki/$wikiname_short",
- destdir => "/var/www/ikiwiki/$wikiname_short",
- repository => "/var/lib/ikiwiki/$wikiname_short.git",
- dumpsetup => "/var/lib/ikiwiki/$wikiname_short.setup",
- url => "/ikiwiki/$wikiname_short",
- cgiurl => "/ikiwiki/$wikiname_short/ikiwiki.cgi",
- cgi_wrapper => "/var/www/ikiwiki/$wikiname_short/ikiwiki.cgi",
- add_plugins => [qw{goodstuff websetup comments calendar sidebar trail httpauth}],
- rss => 1,
- atom => 1,
- syslog => 1,
- example => "blog",
- comments_pagespec => "posts/* and !*/Discussion",
- archive_pagespec => "page(posts/*) and !*/Discussion",
- global_sidebars => 0,
- discussion => 0,
- tagbase => "tags",
-)
-'''
def parse_arguments():
"""Return parsed command line arguments as dictionary."""
@@ -171,13 +90,13 @@ def subcommand_get_enabled(_):
def subcommand_enable(_):
"""Enable ikiwiki site."""
- subprocess.check_call(['a2enconf', 'ikiwiki'])
+ subprocess.check_call(['a2enconf', 'ikiwiki-plinth'])
subprocess.check_call(['service', 'apache2', 'reload'])
def subcommand_disable(_):
"""Disable ikiwiki site."""
- subprocess.check_call(['a2disconf', 'ikiwiki'])
+ subprocess.check_call(['a2disconf', 'ikiwiki-plinth'])
subprocess.check_call(['service', 'apache2', 'reload'])
@@ -236,17 +155,7 @@ def setup():
os.makedirs(SITE_PATH)
subprocess.check_call(['a2enmod', 'cgi'])
-
- with open(CONFIG_FILE, 'w') as conffile:
- conffile.write(apache_cgi_configuration)
-
- with open(SETUP_WIKI, 'w') as setupfile:
- setupfile.writelines(ikiwiki_setup_automator)
-
- with open(SETUP_BLOG, 'w') as setupfile:
- setupfile.writelines(ikiwiki_setup_automator_blog)
-
- subprocess.check_call(['a2enconf', 'ikiwiki'])
+ subprocess.check_call(['a2enconf', 'ikiwiki-plinth'])
subprocess.check_call(['service', 'apache2', 'restart'])
diff --git a/data/etc/apache2/conf-available/ikiwiki-plinth.conf b/data/etc/apache2/conf-available/ikiwiki-plinth.conf
new file mode 100644
index 000000000..ba417eede
--- /dev/null
+++ b/data/etc/apache2/conf-available/ikiwiki-plinth.conf
@@ -0,0 +1,6 @@
+Alias /ikiwiki /var/www/ikiwiki
+AddHandler cgi-script .cgi
+
+
+ Options +ExecCGI
+
diff --git a/data/etc/ikiwiki/plinth-blog.setup b/data/etc/ikiwiki/plinth-blog.setup
new file mode 100644
index 000000000..9426257cf
--- /dev/null
+++ b/data/etc/ikiwiki/plinth-blog.setup
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# Ikiwiki setup automator for Plinth (blog version).
+
+require IkiWiki::Setup::Automator;
+
+our $wikiname=$ARGV[0];
+our $admin=$ARGV[1];
+if (($wikiname eq "") || ($admin eq "")) {
+ print "Usage: ikiwiki -setup /etc/ikiwiki/plinth-blog.setup blog_name admin_name";
+ exit;
+}
+
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
+
+IkiWiki::Setup::Automator->import(
+ wikiname => $wikiname,
+ adminuser => [$admin],
+ rcs => "git",
+ srcdir => "/var/lib/ikiwiki/$wikiname_short",
+ destdir => "/var/www/ikiwiki/$wikiname_short",
+ repository => "/var/lib/ikiwiki/$wikiname_short.git",
+ dumpsetup => "/var/lib/ikiwiki/$wikiname_short.setup",
+ url => "/ikiwiki/$wikiname_short",
+ cgiurl => "/ikiwiki/$wikiname_short/ikiwiki.cgi",
+ cgi_wrapper => "/var/www/ikiwiki/$wikiname_short/ikiwiki.cgi",
+ add_plugins => [qw{goodstuff websetup comments calendar sidebar trail httpauth}],
+ rss => 1,
+ atom => 1,
+ syslog => 1,
+ example => "blog",
+ comments_pagespec => "posts/* and !*/Discussion",
+ archive_pagespec => "page(posts/*) and !*/Discussion",
+ global_sidebars => 0,
+ discussion => 0,
+ tagbase => "tags",
+)
diff --git a/data/etc/ikiwiki/plinth-wiki.setup b/data/etc/ikiwiki/plinth-wiki.setup
new file mode 100644
index 000000000..3880eecab
--- /dev/null
+++ b/data/etc/ikiwiki/plinth-wiki.setup
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+# Ikiwiki setup automator for Plinth.
+
+require IkiWiki::Setup::Automator;
+
+our $wikiname=$ARGV[0];
+our $admin=$ARGV[1];
+if (($wikiname eq "") || ($admin eq "")) {
+ print "Usage: ikiwiki -setup /etc/ikiwiki/plinth-wiki.setup wiki_name admin_name";
+ exit;
+}
+
+our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
+
+IkiWiki::Setup::Automator->import(
+ wikiname => $wikiname,
+ adminuser => [$admin],
+ rcs => "git",
+ srcdir => "/var/lib/ikiwiki/$wikiname_short",
+ destdir => "/var/www/ikiwiki/$wikiname_short",
+ repository => "/var/lib/ikiwiki/$wikiname_short.git",
+ dumpsetup => "/var/lib/ikiwiki/$wikiname_short.setup",
+ url => "/ikiwiki/$wikiname_short",
+ cgiurl => "/ikiwiki/$wikiname_short/ikiwiki.cgi",
+ cgi_wrapper => "/var/www/ikiwiki/$wikiname_short/ikiwiki.cgi",
+ add_plugins => [qw{goodstuff websetup httpauth}],
+ rss => 1,
+ atom => 1,
+ syslog => 1,
+)
diff --git a/setup.py b/setup.py
index 67bb9572f..4162321a6 100755
--- a/setup.py
+++ b/setup.py
@@ -132,6 +132,8 @@ setuptools.setup(
glob.glob('data/etc/apache2/conf-available/*.conf')),
('/etc/apache2/sites-available',
glob.glob('data/etc/apache2/sites-available/*.conf')),
+ ('/etc/ikiwiki',
+ glob.glob('data/etc/ikiwiki/*.setup')),
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
('/lib/systemd/system',
['data/lib/systemd/system/plinth.service']),