1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#!/usr/bin/env bash
#
# Perform post-install updates after lirc or externak driver install:
# - Create the drivers.yaml list from the configs directory
# - Add kernel drivers as present in current kernel.
# - Update hardcoded paths in doc generation tools
# - Update the table.html driver info page.
# - Update the external driver documentation
#
# Usage:
# [DESTDIR=foo] [PYTHON=bar] lirc-postinstall [config.py]
#
# config.py defines numerous paths which can be set environment; see below.
#
# Why is it needed:
# Part of this cannot be run during cross-compile builds.
#
readonly PYTHON=${PYTHON:-'python3'}
readonly HERE=$($PYTHON -c "import os.path; print(os.path.realpath(\"$0\"))")
test -f $1 && source $1 || :
if test -n "$DOCDIR"; then
readonly DOCDIR="$DESTDIR/${DOCDIR}"
else
readonly DOCDIR="../doc"
fi
if test -n "$BINDIR"; then
readonly BINDIR="$DESTDIR/${BINDIR}"
else
readonly BINDIR="../tools"
fi
readonly DATADIR="$DESTDIR/${DATADIR:-'..'}"
if test -n "$LIBDIR"; then
readonly PLUGINDIR=$DESTDIR/${LIBDIR}"/lirc/plugins"
else
readonly PLUGINDIR=$DESTDIR'/../plugins/.libs'
fi
cd $DATADIR/lirc/configs
lirc-lsplugins -U $PLUGINDIR --yaml > drivers.yaml
if ping -c 1 sourceforge.net &> /dev/null; then
XDG_CACHE_HOME=$DATADIR irdb-get update
fi
XDG_CACHE_HOME=$DATADIR irdb-get yaml-config > confs_by_driver.yaml
readonly TOOLDOCDIR="$DATADIR/lirc/doc"
readonly DESTDOCDIR="$DATADIR/doc/lirc"
readonly PLUGINDOCS="$DATADIR/doc/lirc/plugindocs"
readonly PYTHON_PKG="$DATADIR/lirc/python-pkg/lirc"
readonly PYTHON_PATH="$PYTHON_PKG:$DATADIR/lirc/python-pkg"
sed -e '/page.xsl"/s|=.*/>|="'$PLUGINDOCS'/page.xsl"/>|' \
-e '/driver-toc.xsl"/s|=.*/>|="'$PLUGINDOCS'/driver-toc.xsl"/>|' \
-i $TOOLDOCDIR/docpage.xsl
for table in $DESTDOCDIR/html/table.html $DESTDOCDIR/lirc.org/html/table.html
do
PYTHONPATH="$PYTHON_PATH" $PYTHON $BINDIR/lirc-data2table $PWD $PWD \
| xsltproc --html $TOOLDOCDIR/docpage.xsl - > $table
done
make -C $PLUGINDOCS
|