Page 1 of 1

Easily installing new Oxygen publishing engines in linux

Posted: Tue Jan 05, 2021 6:36 pm
by chrispitude
Hi everyone,

We use the Oxygen publishing engine in a linux environment to create our final production-ready PDFs. I thought I'd share the linux script that I use to download and configure the publishing engine:

Code: Select all

#!/bin/bash

rm -rf oxygen-publishing-engine-3.x
OXY=`realpath oxygen-publishing-engine-3.x`
REPO=/u/doc/git/dita-git-repo

# external named URLs do not resolve in our internal network environment
wget http://89.36.26.124/InstData/PublishingEngine/oxygen-publishing-engine-3.x.zip

# uncompress the publishing engine
unzip -q ./oxygen-publishing-engine-*.zip
rm ./oxygen-publishing-engine-*.zip

# install the license key
cp ./licensekey.txt ${OXY}/plugins/com.oxygenxml.pdf.css/lib/oxygen-pdf-chemistry

# install our company plugins
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN1 ${OXY}/plugins/
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN2 ${OXY}/plugins/
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN3 ${OXY}/plugins/
${OXY}/bin/dita --install

# install the Windows fonts
rm -rf ${OXY}/plugins/com.oxygenxml.pdf.css/lib/oxygen-pdf-chemistry/config/fonts
ln -s `realpath ./fonts` ${OXY}/plugins/com.oxygenxml.pdf.css/lib/oxygen-pdf-chemistry/config/fonts

# rename by build number, then make a filesystem link
BUILD=`grep -P -o '(?<=build )(\d+)' oxygen-publishing-engine-3.x/DITA-OT.README_OXYGEN.txt`
rm -rf ./oxygen-publishing-engine-3.x-${BUILD}
mv ./oxygen-publishing-engine-3.x ./oxygen-publishing-engine-3.x-${BUILD}
ln -s ./oxygen-publishing-engine-3.x-${BUILD} ./oxygen-publishing-engine-3.x
This script does the following:
  • Downloads and decompresses the current version of the publishing engine.
  • Installs the "licensekey.txt" file located in the current directory.
  • Creates filesystem links to DITA-OT plugins stored in a Git repo directory.
  • Creates a filesystem link to an additional fonts directory.
  • Renames publishing engine directory by its build number, then creates a filesystem link to it without the build number.
By installing the DITA-OT plugins via filesystem links to our Git repo, the publishing engine always incorporates the latest plugin updates from our repo (schema adjustments, specializations, etc.).

Here's what the working directory looks like before the script is run:

Code: Select all

% ls -l
total 161516
     4 drwxrwxrwx 2 doc src      4096 Jan  5 04:37 fonts/
     4 -rw-rw-rw- 1 doc src       295 Jan  5 04:37 licensekey.txt
     4 -rwxrwxrwx 1 doc src      2263 Jan  5 05:10 update.sh*
Here's what it looks like the script is run:

Code: Select all

% ls -l
total 161516
     4 drwxrwxrwx 2 doc src      4096 Jan  5 04:37 fonts/
     4 -rw-rw-rw- 1 doc src       295 Jan  5 04:37 licensekey.txt
     0 lrwxrwxrwx 1 doc src        41 Jan  5 05:11 oxygen-publishing-engine-3.x -> ./oxygen-publishing-engine-3.x-2020121802/
     4 drwxr-xr-x 7 doc src      4096 Dec 18 04:25 oxygen-publishing-engine-3.x-2020121802/
     4 -rwxrwxrwx 1 doc src      2263 Jan  5 05:10 update.sh*
You can use this script to install multiple build versions, then manually adjust the no-build-number filesystem link to point to whichever version you like.

Re: Easily installing new Oxygen publishing engines in linux

Posted: Wed Jan 06, 2021 11:03 am
by Dan
Thank you for sharing!

Re: Easily installing new Oxygen publishing engines in linux

Posted: Tue May 09, 2023 2:42 pm
by chrispitude
Here is an updated script that uses the current archive file naming convention (no more "-3.x" in the file name). It also fixes a bug with how the fonts/ filesystem link was created.

Code: Select all

#!/bin/bash

# get the absolute on-disk path to where the archive will place the publishing engine
rm -rf ./oxygen-publishing-engine  # must remove before evaluating realpath
OXYPUB=$(realpath ./oxygen-publishing-engine)

# remove any leftover archives
rm -f ./oxygen-publishing-engine.zip*

# download the archive (current production release)
wget https://www.oxygenxml.com/InstData/PublishingEngine/oxygen-publishing-engine.zip --no-check-certificate

# make sure archive exists
if [ ! -f 'oxygen-publishing-engine.zip' ]; then
  echo "Could not download 'oxygen-publishing-engine.zip'."
  exit 1
fi

# uncompress the archive
unzip -q ./oxygen-publishing-engine.zip
rm -f ./oxygen-publishing-engine.zip*

# make sure uncompressed directory exists
if [ ! -d "${OXYPUB}" ]; then
  echo "Could not find '${OXYPUB}' directory."
  exit 1
fi

# install the license key
ln -s $(realpath ./licenses/licensekey_publishing_engine.txt) ${OXYPUB}/licensekey.txt

# install our company plugins
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN1 ${OXY}/plugins/
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN2 ${OXY}/plugins/
ln -s ${REPO}/prj/dita_plugins/com.my.PLUGIN3 ${OXY}/plugins/

# install the Windows fonts
rm -rf ${OXYPUB}/plugins/com.oxygenxml.pdf.css/lib/oxygen-pdf-chemistry/config/fonts
ln -s $(realpath ./fonts) ${OXYPUB}/plugins/com.oxygenxml.pdf.css/lib/oxygen-pdf-chemistry/config/

# rename by build number, then make a filesystem link
BUILD=$(perl -ne 'm{Oxygen \d\d\.\d, build (\d+)} && print $1;' ${OXYPUB}/DITA-OT.README_OXYGEN.txt)
VERSION=$(perl -ne 'm{Oxygen (\d\d\.\d), build \d+} && print $1;' ${OXYPUB}/DITA-OT.README_OXYGEN.txt)
OXYPUB_FULL=${OXYPUB}-${VERSION}-${BUILD}
rm -rf ${OXYPUB_FULL}
mv ${OXYPUB} ${OXYPUB_FULL}
ln -s ${OXYPUB_FULL} ${OXYPUB}