65 lines
1.2 KiB
Bash
Executable file
65 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
case "${1}" in
|
|
configure)
|
|
db_get dokuwiki-templates/templates
|
|
TEMPLATES="${RET:-none}"
|
|
|
|
db_stop
|
|
|
|
# Handling templates
|
|
DIRECTORIES="$(cd /usr/share/dokuwiki/templates-extra && ls -d */ | sed -e 's|/$||g')"
|
|
|
|
case "${TEMPLATES}" in
|
|
all)
|
|
TEMPLATES="${DIRECTORIES}"
|
|
;;
|
|
|
|
none)
|
|
TEMPLATES=""
|
|
;;
|
|
|
|
*)
|
|
TEMPLATES="$(echo ${TEMPLATES} | sed -e 's|,| |g')"
|
|
;;
|
|
esac
|
|
|
|
# Disabling all templates
|
|
for TEMPLATE in ${DIRECTORIES}
|
|
do
|
|
if [ -L "/var/lib/dokuwiki/lib/tpl/${TEMPLATE}" ]
|
|
then
|
|
if [ "$(dirname $(readlink /var/lib/dokuwiki/lib/tpl/"${TEMPLATE}"))" = "/usr/share/dokuwiki/templates-extra" ]
|
|
then
|
|
rm -f "/var/lib/dokuwiki/lib/tpl/${TEMPLATE}"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# Enabling selected templates
|
|
for TEMPLATE in ${TEMPLATES}
|
|
do
|
|
if [ -e "/usr/share/dokuwiki/templates-extra/${TEMPLATE}" ]
|
|
then
|
|
ln -s "/usr/share/dokuwiki/templates-extra/${TEMPLATE}" "/var/lib/dokuwiki/lib/tpl/${TEMPLATE}"
|
|
fi
|
|
done
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`${1}'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
#DEBHELPER#
|
|
|
|
exit 0
|