Installation of the AsciiDoc Utility on Solaris
By Julien Gabel on Sunday 12 November 2006, 22:22 - OpenSolaris - Permalink
Because it must always be easy to install, and uninstall, some new tools to
try, here is a very quick and little update against the last installation
script ((un)install.sh), in order to work out of the box on
Solaris and
OpenSolaris distributions. It try to preserve the very same
behavior for (the original-targeted) Linux platform, although not tested on
it.
Here is the diff against the AsciiDoc 8.1.0 release:
--- install.sh.orig Sat Oct 21 09:21:11 2006
+++ install.sh Sat Nov 11 14:02:21 2006
@@ -1,36 +1,61 @@
-#! /bin/sh
-#
+#!/usr/bin/env sh
+
# AsciiDoc canonical installer/uninstaller.
# Definative packager's guide.
# Documented in INSTALL file.
-#
-BINDIR=/usr/local/bin
-MANDIR=/usr/local/man
-CONFDIR=/etc/asciidoc
+case `uname -s` in
+ SunOS)
+ install=/usr/ucb/install
+ sfwdir=/opt/sfw
+ bindir=${sfwdir}/bin
+ mandir=${sfwdir}/man
+ cnfdir=${sfwdir}/etc/asciidoc
+ ;;
+ *)
+ install=/bin/install
+ sfwdir=/usr/local
+ bindir=${sfwdir}/bin
+ mandir=${sfwdir}/man
+ cnfdir=/etc/asciidoc
+ ;;
+esac
-if [ `basename $0` == uninstall.sh ]; then
- rm $BINDIR/asciidoc
- rm $BINDIR/a2x
- rm $MANDIR/man1/asciidoc.1
- rm $MANDIR/man1/a2x.1
- rm -rf $CONFDIR
+if [ "`basename $0`" = "uninstall.sh" ]; then
+ rm ${bindir}/asciidoc 2> /dev/null
+ rm ${bindir}/a2x 2> /dev/null
+ rmdir ${bindir} 2> /dev/null
+ rm ${mandir}/man1/asciidoc.1 2> /dev/null
+ rm ${mandir}/man1/a2x.1 2> /dev/null
+ rmdir ${mandir}/man1 2> /dev/null
+ rmdir ${mandir} 2> /dev/null
+ rm -rf ${cnfdir}
else
- install asciidoc.py $BINDIR/asciidoc
- install a2x $BINDIR/a2x
- install -d $MANDIR/man1
- install doc/*.1 $MANDIR/man1
- install -d $CONFDIR/filters $CONFDIR/docbook-xsl \
- $CONFDIR/stylesheets $CONFDIR/javascripts \
- $CONFDIR/images/icons/callouts
- install -m 644 *.conf $CONFDIR
- install filters/*.py $CONFDIR/filters
- install -m 644 filters/*.conf $CONFDIR/filters
- install -m 644 docbook-xsl/*.xsl $CONFDIR/docbook-xsl
- install -m 644 stylesheets/*.css $CONFDIR/stylesheets
- install -m 644 javascripts/*.js $CONFDIR/javascripts
- install -m 644 images/icons/callouts/* $CONFDIR/images/icons/callouts
- install -m 644 images/icons/README images/icons/*.png $CONFDIR/images/icons
+ cp a2x a2x.$$
+ sed -e 's,#!/bin/bash,#!/usr/bin/env bash,' \
+ -e "s,/etc/asciidoc,${cnfdir}," a2x.$$ > a2x
+ cp asciidoc.py asciidoc.py.$$
+ sed -e "s,/etc/asciidoc,${cnfdir}," asciidoc.py.$$ > asciidoc.py
+ ${install} -d ${bindir}
+ ${install} asciidoc.py ${bindir}/asciidoc
+ ${install} a2x ${bindir}/a2x
+ ${install} -d ${mandir}/man1
+ ${install} doc/*.1 ${mandir}/man1
+ for dir in ${cnfdir}/filters ${cnfdir}/docbook-xsl ${cnfdir}/stylesheets \
+ ${cnfdir}/javascripts ${cnfdir}/images/icons/callouts; do
+ ${install} -d ${dir}
+ done
+ ${install} -m 644 *.conf ${cnfdir}
+ ${install} filters/*.py ${cnfdir}/filters
+ ${install} -m 644 filters/*.conf ${cnfdir}/filters
+ ${install} -m 644 docbook-xsl/*.xsl ${cnfdir}/docbook-xsl
+ ${install} -m 644 stylesheets/*.css ${cnfdir}/stylesheets
+ ${install} -m 644 javascripts/*.js ${cnfdir}/javascripts
+ ${install} -m 644 images/icons/callouts/* ${cnfdir}/images/icons/callouts
+ ${install} -m 644 images/icons/README images/icons/*.png ${cnfdir}/images/icons
+
+ mv a2x.$$ a2x
+ mv asciidoc.py.$$ asciidoc.py
fi
-# vim: set et ts=4 sw=4 sts=4:
+exit 0
This tool is one of the utilities mentioned on the excellent OpenSolaris Documentation Tools web page.

Oracle ACE