Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace xsltproc/fop by asciidoctor-pdf #5968

Merged
merged 12 commits into from
Jan 13, 2021
Merged
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ docs/*.fo
docs/docbook/xsl/import-fo.xsl
docs/docbook/xsl/titlepage-fo.xsl
docs/docbook/*.docbook
docs/html/*.html
docs/html/index.js
docs/*.html
docs/index.js

# trap stats graphs
# TODO we should move them under var/
Expand Down
75 changes: 19 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
include config.mk
DOCBOOK_XSL := /usr/share/xml/docbook/stylesheet/docbook-xsl
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
DOCBOOK_XSL := /opt/local/share/xsl/docbook-xsl
else ifneq ("$(wildcard /etc/redhat-release)","")
DOCBOOK_XSL := /usr/share/sgml/docbook/xsl-stylesheets
endif

all:
@echo "Please chose which documentation to build:"
Expand All @@ -17,89 +10,59 @@ all:
@echo " 'docs/PacketFence_Network_Devices_Configuration_Guide.pdf' will build the Network Devices Configuration guide in PDF"
@echo " 'docs/PacketFence_Upgrade_Guide.pdf' will build the Upgrade guide in PDF"

DOCINFO_XMLS := $(notdir $(wildcard docs/PacketFence_*-docinfo.xml))
ASCIIDOCS := $(patsubst %-docinfo.xml, %.asciidoc, $(DOCINFO_XMLS))
ASCIIDOCS := $(notdir $(wildcard docs/PacketFence_*.asciidoc))
PDFS = $(patsubst %.asciidoc,docs/%.pdf, $(ASCIIDOCS))

docs/docbook/xsl/titlepage-fo.xsl: docs/docbook/xsl/titlepage-fo.xml
xsltproc \
-o docs/docbook/xsl/titlepage-fo.xsl \
$(DOCBOOK_XSL)/template/titlepage.xsl \
docs/docbook/xsl/titlepage-fo.xml

docs/docbook/xsl/import-fo.xsl:
@echo "<?xml version='1.0'?> \
<xsl:stylesheet \
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" \
xmlns:fo=\"http://www.w3.org/1999/XSL/Format\" \
version=\"1.0\"> \
<xsl:import href=\"${DOCBOOK_XSL}/fo/docbook.xsl\"/> \
</xsl:stylesheet>" \
> docs/docbook/xsl/import-fo.xsl

docs/docbook/%.docbook: docs/%.asciidoc
asciidoc \
-a docinfo2 \
-b docbook \
-d book \
-f docs/docbook/docbook45.conf \
-o $@ $<

docs/%.fo: docs/docbook/%.docbook docs/docbook/xsl/titlepage-fo.xsl docs/docbook/xsl/import-fo.xsl
xsltproc \
-o $@ \
docs/docbook/xsl/packetfence-fo.xsl \
$<
clean:
rm -f docs/*.html docs/*.pdf

docs/%.pdf: docs/%.fo
fop \
-c docs/fonts/fop-config.xml \
$< -pdf $@
docs/%.pdf: docs/%.asciidoc
asciidoctor-pdf \
-a pdf-theme=docs/asciidoctor-pdf-theme.yml \
-a pdf-fontsdir=docs/fonts \
$<

.PHONY: pdf

pdf: $(PDFS)

HTML = $(patsubst %.asciidoc,docs/html/%.html, $(ASCIIDOCS))
HTML = $(patsubst %.asciidoc,docs/%.html, $(ASCIIDOCS))

docs/html/%.html: docs/%.asciidoc
docs/%.html: docs/%.asciidoc
asciidoctor \
-D docs/html \
-n \
-r ./docs/html/asciidoctor-html.rb \
-a imagesdir=../images \
-r ./docs/asciidoctor-html.rb \
-a stylesdir=../html/pfappserver/root/static.alt/dist/css \
-a stylesheet=$(notdir $(wildcard ./html/pfappserver/root/static.alt/dist/css/app*.css)) \
$<

html/pfappserver/root/static/doc:
make html
mkdir html/pfappserver/root/static/doc
mkdir html/pfappserver/root/static/images
cp -a docs/html/* html/pfappserver/root/static/doc
cp -a docs/images/* html/pfappserver/root/static/images
mkdir -p html/pfappserver/root/static/doc/images
cp -a docs/*.html html/pfappserver/root/static/doc
cp -a docs/images/* html/pfappserver/root/static/doc/images
nqb marked this conversation as resolved.
Show resolved Hide resolved

docs/html/index.js: $(HTML)
docs/index.js: $(HTML)
find $$(dirname "$@") -type f -iname '*.html' -and -not -iname '*template*' -printf "{\"name\":\"%f\", \"size\":%s, \"last_modifed\" : %T@}\n" | jq -s '{ items: [ .[] | {name, size, last_modifed : (.last_modifed*1000 | floor)} ] }' > $@

.PHONY: images

images:
@echo "install images dir and all subdirectories"
for subdir in `find docs/images/* -type d -printf "%f\n"` ; do \
install -d -m0755 $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/images/$$subdir ; \
install -d -m0755 $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/doc/images/$$subdir ; \
for img in `find docs/images/$$subdir -type f`; do \
install -m0644 $$img $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/images/$$subdir ; \
install -m0644 $$img $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/doc/images/$$subdir ; \
done \
done
@echo "install only images at depth0 in images/ directory"
for img in `find docs/images/* -maxdepth 0 -type f`; do \
install -m0644 $$img $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/images/ ; \
install -m0644 $$img $(DESTDIR)/usr/local/pf/html/pfappserver/root/static/doc/images/ ; \
done

.PHONY: html

html: $(HTML) docs/html/index.js
html: $(HTML) docs/index.js

pfcmd.help:
/usr/local/pf/bin/pfcmd help > docs/installation/pfcmd.help
Expand Down
70 changes: 33 additions & 37 deletions UPGRADE.asciidoc
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
= PacketFence Upgrade Guide
:encoding: UTF-8
:lang: en
:doctype: book
:toc: left

// to display images directly on GitHub
ifdef::env-github[]
:imagesdir: images
:extra_path: docs/
endif::[]
:extra_path:
////

This file is part of the PacketFence project.

////
See docs/includes/global-attributes.asciidoc for authors, copyright and
license information.

////
// Fix includes on GitHub
:extra_path:
ifdef::env-github[]
:extra_path: docs/
endif::[]
cgx marked this conversation as resolved.
Show resolved Hide resolved
include::{extra_path}includes/global-attributes.asciidoc[]

== About this Guide
Expand Down Expand Up @@ -220,7 +216,7 @@ steps required depending on the version you are upgrading from.

==== New versions of configuration files

You should take care to review any changes to configuration files and merge them if required.
You should take care to review any changes to configuration files and merge them if required.

===== RHEL / CentOS based systems

Expand Down Expand Up @@ -327,21 +323,21 @@ In order to upgrade the MariaDB metadata files and tables, first stop any starte

systemctl stop mariadb
systemctl stop packetfence-mariadb

Then start a mysqld_safe process manually (this will start a background process)

mkdir -p /var/run/mariadb
chown mysql: /var/run/mariadb
mysqld_safe --basedir=/usr &

Then, execute the upgrade script and enter the root password when prompted

mysql_upgrade -u root -p

When done, kill the mysqld_safe process we started before the update, reattach to it and wait for it to exit

kill %1 && fg

Note that it might take up to a few minutes for the process to exit depending on the size of your database.

Once done, restart the MariaDB service (managed by PacketFence)
Expand Down Expand Up @@ -445,7 +441,7 @@ Clear the redis queue to avoid old stale jobs from being processes.
systemctl start packetfence-redis_queue
redis-cli -p 6380 FLUSHALL
systemctl stop packetfence-redis_queue

=== SSL certificates


Expand All @@ -465,7 +461,7 @@ A complete re-visit of the database clustering stack was done in version 7.0. If

==== Active/Active clusters with Active/Passive DB (default before 7.0)

We highly suggest you migrate your existing clustered installation using Corosync/Pacemaker to the new cluster stack of PacketFence that uses MariaDB Galera cluster.
We highly suggest you migrate your existing clustered installation using Corosync/Pacemaker to the new cluster stack of PacketFence that uses MariaDB Galera cluster.
The easiest way to perform this is to build new servers and port your configuration (by copying the configuration files) and your database (using mysqldump).
There are ways to migrate the 2 existing nodes to a 3 nodes cluster but this is not covered in this guide.

Expand All @@ -478,14 +474,14 @@ You will simply have to adjust your Corosync configuration so that MariaDB point
op start timeout=60s interval=0 \
op stop timeout=60s interval=0 \
op monitor interval=20s timeout=30s

===== Disabling Galera cluster

You must then disable the MariaDB Galera cluster as a replication mechanism as you will still be using DRBD. In order to do so, add the following in `/usr/local/pf/conf/pf.conf`

[active_active]
galera_replication=disabled

===== IP address bind

You must also instruct packetfence-mariadb to bind to the management IP address of the server manually.
Expand All @@ -509,7 +505,7 @@ Where 1.2.3.4 is the management IP address of the server.
Like in previous versions where mariadb shouldn't have been started on boot, now you must ensure its replacement (packetfence-mariadb) doesn't start on boot.

systemctl disable packetfence-mariadb

*Enabling the packetfence-cluster target*

Next, you must set the default target to packetfence-cluster:
Expand Down Expand Up @@ -592,7 +588,7 @@ PacketFence is now able to instruct Samba to «pin» a DC for authentication or
You should instruct Samba to connect to all domain controllers by adding the following to each of your domains in domain.conf:

sticky_dc=*

And then regenerate the domain configuration:

/usr/local/pf/bin/pfcmd fixpermissions
Expand Down Expand Up @@ -680,7 +676,7 @@ If you use social login with LinkedIn OAuth2, you will need to adjust the list o
For all your LinkedIn sources, change the domains to:

www.linkedin.com,api.linkedin.com,*.licdn.comlatform.linkedin.com

=== Portal redirection timer


Expand Down Expand Up @@ -765,7 +761,7 @@ In order to do so, execute the following:
=== Changes to DNS filters


The $qname parameter need to be removed from dns_filters.conf
The $qname parameter need to be removed from dns_filters.conf

In order to do so, execute the following command:

Expand All @@ -783,7 +779,7 @@ To upgrade the database schema, run the following command:

Once completed, update the file /usr/local/pf/conf/currently-at to match the new release number (PacketFence 8.0.0).

== Upgrading from a version prior to 8.1.0
== Upgrading from a version prior to 8.1.0


=== Changes on unreg_on_accounting_stop parameter
Expand Down Expand Up @@ -814,16 +810,16 @@ The queue_stats maintenance job has been deprecated in favor of using pfstats. I

/usr/local/pf/addons/upgrade/to-8.2-pfmon-conf.pl

=== Upgrade pfdetect perl regex to the go RE2 regex
=== Upgrade pfdetect Perl regex to the go RE2 regex

The pfdetect was moved from perl to go so all rule regexes have to be converted to the RE2 regex syntax.
RE2 is mostly is compatiable the perl regex syntax.
The pfdetect was moved from Perl to Go so all rule regexes have to be converted to the RE2 regex syntax.
RE2 is mostly is compatiable the Perl regex syntax.
More information on the RE2 syntax can be found here https://github.com/google/re2/wiki/Syntax.
To upgrade the regex run:

/usr/local/pf/addons/upgrade/to-8.2-pfdetect-conf.pl

Any perl regex that cannnot be convert will be displayed and should be fixed.
Any Perl regex that cannnot be convert will be displayed and should be fixed.

=== Upgrade realm.conf to be tenant aware

Expand Down Expand Up @@ -942,14 +938,14 @@ the dhcp answer on the fly.
The violations have been renamed to security events. In order to make the appropriate changes in your configuration, execute the following script:

/usr/local/pf/addons/upgrade/to-9.0-security-events.sh

=== Removed MAC detection setting


The MAC detection setting in the switches has been removed. In order to cleanup the switches configuration for the removal of this setting, execute the following script:

/usr/local/pf/addons/upgrade/to-9.0-remove_mac_detection.sh

=== Modifications to accounting cleanup


Expand All @@ -961,7 +957,7 @@ Accounting cleanup is now done via a pfmon task (acct_cleanup) instead of the da
In order to upgrade the Admin rights, run the following commands

cd /usr/local/pf
sed -i "s/SERVICES/SERVICES_READ/g" /usr/local/pf/conf/adminroles.conf
sed -i "s/SERVICES/SERVICES_READ/g" /usr/local/pf/conf/adminroles.conf
sed -i "s/REPORTS/REPORTS_READ/g" /usr/local/pf/conf/adminroles.conf

=== Database schema
Expand Down Expand Up @@ -1095,7 +1091,7 @@ installed, this one has been upgraded to latest version.

NOTE: This step needs to be done *before* packages upgrade.

In order to install new versions of Debian packages, you will need to add a new GPG key to your system:
In order to install new versions of Debian packages, you will need to add a new GPG key to your system:

[source,bash]
----
Expand Down Expand Up @@ -1297,7 +1293,7 @@ This script will add the prefix:

=== Changes in RADIUS configuration for better LDAP support

In order to improve LDAP support when using RADIUS, new files and configuration parameters have been added.
In order to improve LDAP support when using RADIUS, new files and configuration parameters have been added.
This script will update your current configuration:

[source,bash]
Expand Down
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ install: build

# Documentation
make html
# install html and images dirs in pfappserver for embedded doc
# install html in pfappserver for embedded doc
install -d -m0755 $(CURDIR)/debian/packetfence-doc$(PREFIX)/$(NAME)/html/pfappserver/root/static/doc
for i in `find "docs/html" "(" -name "*.html" -or -iname "*.js" ")" -type f`; do \
for i in `find "docs" "(" -name "*.html" -or -iname "*.js" ")" -type f`; do \
install -m0644 $$i $(CURDIR)/debian/packetfence-doc$(PREFIX)/$(NAME)/html/pfappserver/root/static/doc/; \
done
# images
Expand Down
42 changes: 0 additions & 42 deletions docs/PacketFence_Clustering_Guide-docinfo.xml

This file was deleted.

Loading