Applications that are configurable about fonts and have users configure about fonts by some means are able to achieve dynamic configuration about fonts through Defoma framework. This chapter describes how to build a Defoma-aware application package step by step.
The Defoma configuration script must be put under debian/ subdirectory and its name should be <package-name>.defoma.
(ex: debian/rules)
DIR = `pwd`/debian/<package-name>
...
install: build
...
install -m 644 debian/<package-name>.defoma \
$(DIR)/usr/share/defoma/scripts
(ex: debian/dirs)
usr/share/defoma/scripts
var/lib/defoma/<package-name>.d
(ex: debian/postinst)
...
if [ "$1" = configure ]; then
/usr/bin/defoma-app -t update <package-name>
fi
...
(ex: debian/prerm)
...
if [ "$1" = remove ]; then
/usr/bin/defoma-app -t purge <package-name>
fi
if [ "$1" = upgrade ]; then
/usr/bin/defoma-app -t clean <package-name>
fi
...
In addition, when the application package is removed, /var/lib/defoma/<package-name>.d directory MUST be removed without fail. Edit debian/postrm file to remove the directory.
(ex: debian/postrm)
...
if [ "$1" = remove ]; then
/bin/rm -fr /var/lib/defoma/<package-name>.d
fi
...
(ex: debian/postinst)
...
if [ "$1" = configure ]; then
if [ ! -f "/etc/defoma/<rulename>.subst-rule ]; then
/usr/bin/defoma-subst new-rule <rulename>
fi
..
/usr/bin/defoma-app -t update <package-name>
fi
Created rulefile is considered as conffile, so it must be removed when the package is purged. Edit debian/postrm file to remove the rulefile at purge.
(ex: debian/postrm)
...
FILE='/etc/defoma/<rulename>.subst-rule'
if [ "$1" = purge ]; then
/bin/rm -f $FILE $FILE~
fi
(ex: debian/control)
...
Depends: defoma
...