#!/bin/sh set -e . /usr/share/debconf/confmodule CONFAVAIL=/usr/share/fontconfig/conf.avail CONFDIR=/etc/fonts/conf.d # Check if this is the initial configuration and not an upgrade of an # existing configuration # Usage: if is_initial_configuration "$@"; then ... fi from top level is_initial_configuration() { # Plain installation if [ "$1" = configure ] && [ -z "$2" ]; then return 0 fi # Configuration via dpkg-reconfigure if [ "$1" = reconfigure ] || [ "$DEBCONF_RECONFIGURE" ]; then return 0 fi return 1 } # Create /etc/fonts/conf.d/10-hinting-slight.conf symlink on upgrade, this is # upstream default if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le-nl "2.12.3-0.2~"; then test -e $CONFDIR/10-hinting-slight.conf || \ ln -s $CONFAVAIL/10-hinting-slight.conf $CONFDIR/10-hinting-slight.conf fi # Replace symlinks obsoleted by upstream with their equivalent new ones if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le-nl "2.14.2-5~"; then if [ -h $CONFDIR/10-no-sub-pixel.conf ] && ! readlink -e $CONFDIR/10-no-sub-pixel.conf >/dev/null; then rm $CONFDIR/10-no-sub-pixel.conf test -e $CONFDIR/10-sub-pixel-none.conf || \ ln -s $CONFAVAIL/10-sub-pixel-none.conf $CONFDIR/10-sub-pixel-none.conf fi fi if [ "$1" = "configure" ] && dpkg --compare-versions "$2" le-nl "2.15.0-1.1~"; then if [ -h $CONFDIR/70-no-bitmaps.conf ]; then rm $CONFDIR/70-no-bitmaps.conf test -e $CONFDIR/70-no-bitmaps-except-emoji.conf || \ ln -s $CONFAVAIL/70-no-bitmaps-except-emoji.conf $CONFDIR/70-no-bitmaps-except-emoji.conf fi fi if is_initial_configuration "$@"; then db_get fontconfig/hinting_type hinting_type="$RET" unhinted="10-unhinted.conf" autohint="10-autohint.conf" if [ -h $CONFDIR/$unhinted ]; then rm $CONFDIR/$unhinted fi if [ -h $CONFDIR/$autohint ]; then rm $CONFDIR/$autohint fi case "$hinting_type" in "Native") ;; "Autohinter") ln -s $CONFAVAIL/$autohint $CONFDIR/$autohint ;; "None") ln -s $CONFAVAIL/$unhinted $CONFDIR/$unhinted ;; esac db_get fontconfig/hinting_style hinting_style="$RET" hintnone="10-hinting-none.conf" hintslight="10-hinting-slight.conf" hintmedium="10-hinting-medium.conf" hintfull="10-hinting-full.conf" if [ -h $CONFDIR/$hintnone ]; then rm $CONFDIR/$hintnone fi if [ -h $CONFDIR/$hintslight ]; then rm $CONFDIR/$hintslight fi if [ -h $CONFDIR/$hintmedium ]; then rm $CONFDIR/$hintmedium fi if [ -h $CONFDIR/$hintfull ]; then rm $CONFDIR/$hintfull fi case "$hinting_style" in "hintnone") ln -s $CONFAVAIL/$hintnone $CONFDIR/$hintnone ;; "hintslight") ln -s $CONFAVAIL/$hintslight $CONFDIR/$hintslight ;; "hintmedium") ln -s $CONFAVAIL/$hintmedium $CONFDIR/$hintmedium ;; "hintfull") ln -s $CONFAVAIL/$hintfull $CONFDIR/$hintfull ;; esac db_get fontconfig/subpixel_rendering subpixel_rendering="$RET" subpixel="10-sub-pixel-rgb.conf" no_subpixel="10-sub-pixel-none.conf" if [ -h $CONFDIR/$subpixel ]; then rm $CONFDIR/$subpixel fi if [ -h $CONFDIR/$no_subpixel ]; then rm $CONFDIR/$no_subpixel fi case "$subpixel_rendering" in "Automatic") ;; "Always") ln -s $CONFAVAIL/$subpixel $CONFDIR/$subpixel ;; "Never") ln -s $CONFAVAIL/$no_subpixel $CONFDIR/$no_subpixel ;; esac db_get fontconfig/enable_bitmaps enable_bitmaps="$RET" yes_bitmaps="70-yes-bitmaps.conf" no_bitmaps="70-no-bitmaps-except-emoji.conf" if [ -h $CONFDIR/$yes_bitmaps ]; then rm $CONFDIR/$yes_bitmaps fi if [ -h $CONFDIR/$no_bitmaps ]; then rm $CONFDIR/$no_bitmaps fi case "$enable_bitmaps" in "true") ln -s $CONFAVAIL/$yes_bitmaps $CONFDIR/$yes_bitmaps ;; *) ln -s $CONFAVAIL/$no_bitmaps $CONFDIR/$no_bitmaps ;; esac fi # end changes applied only for initial config / reconfiguration # Create /usr/local/share/fonts LOCALDIR=/usr/local/share/fonts if [ ! -d $LOCALDIR ]; then if mkdir $LOCALDIR 2>/dev/null ; then chmod 2775 $LOCALDIR chown root:staff $LOCALDIR fi fi # fontconfig-config 2.11.0-5 (and earlier) created /etc/fonts.conf.d by mistake # remove it if [ -d /etc/fonts.conf.d ]; then rmdir --ignore-fail-on-non-empty /etc/fonts.conf.d fi