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)
binary-indep: build install
dh_testdir
dh_testroot
dh_installdebconf
dh_installdefoma
dh_installdocs
...
FYI, dh_installdefoma actually performs the following steps.
(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 update <package-name>
fi
...
(ex: debian/prerm)
...
if [ "$1" = remove ]; then
/usr/bin/defoma-app purge <package-name>
fi
if [ "$1" = upgrade ]; then
/usr/bin/defoma-app 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 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)
Build-Depends: defoma (>= 0.7.0)
...
Depends: defoma (>= x.y.z)
...
Which version to depend is decided by what function the script makes use of. See /usr/share/doc/defoma-doc/version-dependency.txt for more detail.
Developers' Guide to Defoma
Yasuhiro Take (take@debian.org)