diff --git a/Makefile b/Makefile
index 7222e7d..9c6d164 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ include ./pve-doc-generator.mk
GEN_PACKAGE=pve-doc-generator
DOC_PACKAGE=pve-docs
+MEDIAWIKI_PACKAGE=pve-docs-mediawiki
# also update debian/changelog
PKGREL=7
@@ -14,6 +15,7 @@ ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
+MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
CHAPTER_LIST= \
sysadmin \
@@ -220,16 +222,15 @@ api-viewer/apidoc.js: api-viewer/apidata.js api-viewer/PVEAPI.js
cat api-viewer/apidata.js api-viewer/PVEAPI.js >$@
.PHONY: dinstall
-dinstall: ${GEN_DEB} ${DOC_DEB}
- dpkg -i ${GEN_DEB} ${DOC_DEB}
+dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
+ dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
.PHONY: deb
deb:
- rm -f ${GEN_DEB} ${DOC_DEB};
- make ${GEN_DEB};
- make ${DOC_DEB};
+ rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
+ make ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB};
-${GEN_DEB} ${DOC_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES}
+${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER_SOURCES} ${GEN_DEB_SOURCES}
rm -rf build
mkdir build
rsync -a debian/ build/debian
@@ -247,19 +248,20 @@ ${GEN_DEB} ${DOC_DEB}: index.html ${INDEX_INCLUDES} ${WIKI_IMPORTS} ${API_VIEWER
# install api doc viewer
mkdir build/usr/share/${DOC_PACKAGE}/api-viewer
install -m 0644 ${API_VIEWER_SOURCES} build/usr/share/${DOC_PACKAGE}/api-viewer
- # build debain package
+ # build Debian packages
cd build; dpkg-buildpackage -rfakeroot -b -us -uc
lintian ${GEN_DEB}
lintian ${DOC_DEB}
+ lintian ${MEDIAWIKI_DEB}
.PHONY: upload
-upload: ${GEN_DEB} ${DOC_DEB}
+upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o rw
mkdir -p /pve/${DOCRELEASE}/extra
rm -f /pve/${DOCRELEASE}/extra/${GEN_PACKAGE}_*.deb
rm -f /pve/${DOCRELEASE}/extra/${DOC_PACKAGE}_*.deb
rm -f /pve/${DOCRELEASE}/extra/Packages*
- cp ${GEN_DEB} ${DOC_DEB} /pve/${DOCRELEASE}/extra
+ cp ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB} /pve/${DOCRELEASE}/extra
cd /pve/${DOCRELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
umount /pve/${DOCRELEASE}; mount /pve/${DOCRELEASE} -o ro
diff --git a/debian/control b/debian/control
index 50d7c8f..46cd222 100644
--- a/debian/control
+++ b/debian/control
@@ -19,3 +19,11 @@ Section: doc
Architecture: all
Description: Proxmox VE Documentation
This package contains the Proxmox VE Documentation files.
+
+Package: pve-docs-mediawiki
+Architecture: all
+Section: doc
+Depends: ${misc:Depends}, pve-docs
+Suggests: apache2
+Description: Proxmox VE Documentation - mediawiki plugin
+ This package contains tools to view Proxmox VE Documentation with mediakiki.
diff --git a/debian/pve-docs-mediawiki.docs b/debian/pve-docs-mediawiki.docs
new file mode 100644
index 0000000..b11f1ee
--- /dev/null
+++ b/debian/pve-docs-mediawiki.docs
@@ -0,0 +1 @@
+debian/tree/pve-docs-mediawiki/README
\ No newline at end of file
diff --git a/debian/pve-docs-mediawiki.install b/debian/pve-docs-mediawiki.install
new file mode 100644
index 0000000..9cf293d
--- /dev/null
+++ b/debian/pve-docs-mediawiki.install
@@ -0,0 +1,3 @@
+debian/tree/pve-docs-mediawiki/pvedocs-include.php /etc/mediawiki-extensions/extensions-available/
+debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import /usr/bin/
+debian/tree/pve-docs-mediawiki/pve-docs.conf /etc/apache2/sites-available/
diff --git a/debian/tree/pve-docs-mediawiki/README b/debian/tree/pve-docs-mediawiki/README
new file mode 100644
index 0000000..29b1440
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/README
@@ -0,0 +1,14 @@
+To enable the apache site use:
+
+# a2ensite pve-docs.conf
+# /etc/init.d/apache2 reload
+
+Now you should be able to access the documentation at:
+
+* Admin Guide and Manual pages
+http://your-server/pve-docs
+
+* API Viewer
+http://your-server/pve-docs/api-viewer
+
+
diff --git a/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import b/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
new file mode 100755
index 0000000..9e3ced0
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
@@ -0,0 +1,173 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Data::Dumper;
+
+use IO::File;
+use File::Basename;
+use MediaWiki::API;
+
+my $config_fn = "/root/.pve-docs"; # format 'username:pw'
+
+my $fh = IO::File->new("$config_fn") ||
+ die "Please configure the mediawiki user/passswd in '$config_fn'\n";
+
+my $api_url = "http://localhost/api.php";
+
+my $config = <$fh>;
+chomp $config;
+
+my ($username, $passwd) = split(':', $config, 2);
+
+my $mw = MediaWiki::API->new();
+$mw->{config}->{api_url} = $api_url;
+
+# log in to the wiki
+$mw->login({ lgname => $username, lgpassword => $passwd })
+ || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
+
+sub update_page {
+ my ($pagename, $include, $category) = @_;
+
+ print "update mediawiki page: $pagename\n";
+
+ my $ref = $mw->get_page( { title => $pagename } );
+ my $page = $ref->{'*'} || '';
+
+ if ($page !~ m/^\{\{#pvedocs:.*\}\}\s*$/m) {
+ $page = "{{#pvedocs:$include}}\n$page";
+ } else {
+ $page =~ s/^\{\{#pvedocs:.*\}\}\s*$/\{\{#pvedocs:$include\}\}\n/m;
+ }
+
+ if ($category) {
+ my $catstr = "Category:$category";
+
+ if ($page !~ m/^\[\[$catstr\]\]\s*$/m) {
+ $page .= "\n[[$catstr]]\n";
+ }
+ }
+
+ my $timestamp = $ref->{timestamp};
+ my $wcmd = {
+ action => 'edit',
+ title => $pagename,
+ basetimestamp => $timestamp, # to avoid edit conflicts
+ text => $page,
+ };
+
+ $mw->edit($wcmd) ||
+ die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
+}
+
+my $cat_refdoc = "Reference Documentation";
+
+my $docs = {
+ 'chapter-ha-manager-plain.html' => {
+ title => "High Availability",
+ category => $cat_refdoc,
+ },
+ 'chapter-sysadmin-plain.html' => {
+ title => "Host System Administration",
+ category => $cat_refdoc,
+ },
+ 'chapter-pct-plain.html' => {
+ title => "Linux Container",
+ category => $cat_refdoc,
+ },
+ 'chapter-pmxcfs-plain.html' => {
+ title => "Proxmox Cluster File System (pmxcfs)",
+ category => $cat_refdoc,
+ },
+ 'chapter-pve-bibliography-plain.html' => {
+ title => "Bibliography",
+ category => $cat_refdoc,
+ },
+ 'chapter-pvecm-plain.html' => {
+ title => "Cluster Manager",
+ category => $cat_refdoc,
+ },
+ 'chapter-pve-faq-plain.html' => {
+ title => "FAQ",
+ category => $cat_refdoc,
+ },
+ 'chapter-pve-firewall-plain.html' => {
+ title => "Firewall",
+ category => $cat_refdoc,
+ },
+ 'chapter-pvesm-plain.html' => {
+ title => "Storage",
+ category => $cat_refdoc,
+ },
+ 'chapter-pveum-plain.html' => {
+ title => "User Management",
+ category => $cat_refdoc,
+ },
+ 'chapter-qm-plain.html' => {
+ title => "Qemu/KVM Virtual Machines",
+ category => $cat_refdoc,
+ },
+ 'chapter-vzdump-plain.html' => {
+ title => "Backup and Restore",
+ category => $cat_refdoc,
+ },
+ 'qm.conf.5-plain.html' => {
+ title => "Manual: vm.conf",
+ category => $cat_refdoc,
+ },
+ 'pct.conf.5-plain.html' => {
+ title => "Manual: pct.conf",
+ category => $cat_refdoc,
+ },
+ 'datacenter.cfg.5-plain.html' => {
+ title => "Manual: datacenter.cfg",
+ category => $cat_refdoc,
+ },
+ # Storage Plugins
+ 'pve-storage-dir-plain.html' => {
+ title => "Storage: Directory",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-glusterfs-plain.html' => {
+ title => "Storage: GlusterFS",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-iscsidirect-plain.html' => {
+ title => "Storage: User Mode iSCSI",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-iscsi-plain.html' => {
+ title => "Storage: iSCSI",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-lvm-plain.html' => {
+ title => "Storage: LVM",
+ category => $cat_refdoc,
+ },q
+ 'pve-storage-lvmthin-plain.html' => {
+ title => "Storage: LVM Thin",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-nfs-plain.html' => {
+ title => "Storage: NFS",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-rbd-plain.html' => {
+ title => "Storage: RBD",
+ category => $cat_refdoc,
+ },
+ 'pve-storage-zfspool-plain.html' => {
+ title => "Storage: ZFS",
+ category => $cat_refdoc,
+ },
+};
+
+#update_page("testpage1", $filename, $d->{category});
+
+foreach my $filename (keys %$docs) {
+ my $path = "/usr/share/pve-docs/$filename";
+ die "no such file '$path'" if ! -f $path;
+ my $d = $docs->{$filename};
+ update_page($d->{title}, $filename, $d->{category});
+}
diff --git a/debian/tree/pve-docs-mediawiki/pve-docs.conf b/debian/tree/pve-docs-mediawiki/pve-docs.conf
new file mode 100644
index 0000000..2b9b8e1
--- /dev/null
+++ b/debian/tree/pve-docs-mediawiki/pve-docs.conf
@@ -0,0 +1,7 @@
+