mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
ikiwiki: Install conf files during Plinth install.
This commit is contained in:
parent
045dae59f7
commit
be14b49c83
@ -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
|
||||
|
||||
<Directory /var/www/ikiwiki>
|
||||
Options +ExecCGI
|
||||
</Directory>
|
||||
'''
|
||||
|
||||
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'])
|
||||
|
||||
|
||||
|
||||
6
data/etc/apache2/conf-available/ikiwiki-plinth.conf
Normal file
6
data/etc/apache2/conf-available/ikiwiki-plinth.conf
Normal file
@ -0,0 +1,6 @@
|
||||
Alias /ikiwiki /var/www/ikiwiki
|
||||
AddHandler cgi-script .cgi
|
||||
|
||||
<Directory /var/www/ikiwiki>
|
||||
Options +ExecCGI
|
||||
</Directory>
|
||||
36
data/etc/ikiwiki/plinth-blog.setup
Normal file
36
data/etc/ikiwiki/plinth-blog.setup
Normal file
@ -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",
|
||||
)
|
||||
30
data/etc/ikiwiki/plinth-wiki.setup
Normal file
30
data/etc/ikiwiki/plinth-wiki.setup
Normal file
@ -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,
|
||||
)
|
||||
2
setup.py
2
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']),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user