Files
libkiwix/test/data/viewer_testing/run
2026-03-17 14:43:49 +04:00

57 lines
979 B
Bash
Executable File

#!/usr/bin/env bash
if [ $# -eq 0 ]
then
echo >&2 "Usage: $0 path-to-kiwix-serve [options ...]"
exit 1
fi
kiwixserve=$(readlink -f "$1")
shift
set -x
mydir=$(dirname "$0")
cd "$mydir"
if [ content/plain/test.html -nt content/plain/dyntest.html ]
then
./generate_dynamic_page
fi
must_wombatize()
{
if [ ! -d content/wombatized ]
then
return 0
fi
if [ ! -d content/_zim_static ]
then
return 0
fi
for f in content/plain/*
do
if [ "$f" -nt "${f/plain/wombatized}" ]
then
return 0
fi
done
return 1
}
if must_wombatize
then
echo "Generating wombatized pages..."
if ! ./wombatize
then
echo "Encountered errors while generating wombatized pages. Exiting..."
exit 1
fi
echo "Successfully generated wombatized pages."
fi
export KIWIX_SERVE_CUSTOMIZED_RESOURCES=kiwix_serve_customized_resources
"$kiwixserve" -p 8080 --library "$@" library.xml