]> git.wh0rd.org - fontconfig.git/blame - debian/fontconfig.postinst
Get the DLL from "bin" where modern libtools put it, not "lib".
[fontconfig.git] / debian / fontconfig.postinst
CommitLineData
dc2e06ab
KP
1#!/bin/sh
2
3set -e
4
5. /usr/share/debconf/confmodule
6
7LOCALCONF=/var/lib/fontconfig/local.conf
8rm -f $LOCALCONF
9
10CONFDIR=/etc/fonts/conf.d
11
12db_get fontconfig/hinting_type
13hinting_type="$RET"
14
15hint_prio="10-debconf-"
16unhinted="unhinted.conf"
17autohint="autohint.conf"
18
19if [ -h $CONFDIR/$hint_prio$unhinted ]; then
20 rm $CONFDIR/$hint_prio$unhinted
21fi
22if [ -h $CONFDIR/$hint_prio$autohint ]; then
23 rm $CONFDIR/$hint_prio$autohint
24fi
25
26case "$hinting_type" in
27"Native")
28 ;;
29"Autohint")
30 ln -s $CONFDIR/$autohint $CONFDIR/$hint_prio$autohint
31 ;;
32"None")
33 ln -s $CONFDIR/$unhinted $CONFDIR/$hint_prio$unhinted
34 ;;
35esac
36
37db_get fontconfig/subpixel_rendering
38subpixel_rendering="$RET"
39
40subpixel_prio="20-debconf-"
41subpixel="sub-pixel.conf"
42no_subpixel="no-sub-pixel.conf"
43
44if [ -h $CONFDIR/$subpixel_prio$subpixel ]; then
45 rm $CONFDIR/$subpixel_prio$subpixel
46fi
47
48if [ -h $CONFDIR/$subpixel_prio$no_subpixel ]; then
49 rm $CONFDIR/$subpixel_prio$no_subpixel
50fi
51
52case "$subpixel_rendering" in
53"Automatic")
54 ;;
683dc3c4 55"Always")
dc2e06ab
KP
56 ln -s $CONFDIR/$subpixel $CONFDIR/$subpixel_prio$subpixel
57 ;;
683dc3c4 58"Never")
dc2e06ab
KP
59 ln -s $CONFDIR/$no_subpixel $CONFDIR/$subpixel_prio$no_subpixel
60 ;;
61esac
62
63db_get fontconfig/enable_bitmaps
64enable_bitmaps="$RET"
65
66bitmaps_prio="30-debconf-"
97bde49a 67yes_bitmaps="yes-bitmaps.conf"
dc2e06ab
KP
68no_bitmaps="no-bitmaps.conf"
69
70if [ -h $CONFDIR/$bitmaps_prio$yes_bitmaps ]; then
71 rm $CONFDIR/$bitmaps_prio$yes_bitmaps
72fi
73
74if [ -h $CONFDIR/$bitmaps_prio$no_bitmaps ]; then
75 rm $CONFDIR/$bitmaps_prio$no_bitmaps
76fi
77
78case "$enable_bitmaps" in
79"true")
80 ln -s $CONFDIR/$yes_bitmaps $CONFDIR/$bitmaps_prio$yes_bitmaps
81 ;;
82*)
83 ln -s $CONFDIR/$no_bitmaps $CONFDIR/$bitmaps_prio$no_bitmaps
84 ;;
85esac
86
87cp /dev/null $LOCALCONF
88rm -f $LOCALCONF.md5sum
89ln -sf /usr/share/fontconfig/local.conf.md5sum $LOCALCONF.md5sum
90ucf --debconf-ok $LOCALCONF /etc/fonts/local.conf
91rm -f $LOCALCONF.md5sum
92
93# if the local.conf file is now empty, remove it
94
95if [ -s /etc/fonts/local.conf ]; then
96 :
97else
98 if [ -f /etc/fonts/local.conf ]; then
99 rm /etc/fonts/local.conf
100 fi
101fi
102
103# Create /usr/local/share/fonts
104LOCALDIR=/usr/local/share/fonts
105if [ ! -d $LOCALDIR ]; then
106 if mkdir $LOCALDIR 2>/dev/null ; then
107 chmod 2775 $LOCALDIR
108 chown root:staff $LOCALDIR
109 fi
110fi
111
112if [ "$1" = configure ]; then
113 # Ensure Defoma subst file exists, with some default substitutions
114 if ! defoma-subst check-rule fontconfig; then
115 defoma-subst new-rule fontconfig \
116 'serif --GeneralFamily,* Roman --Shape Serif Upright --Weight Medium' \
117 'sans-serif --GeneralFamily,* SansSerif --Shape NoSerif Upright --Weight Medium' \
118 'monospace --Width,* Fixed --GeneralFamily,2 Typewriter --Shape Upright --Weight Medium'
119 fi
120fi
121
122if [ -d /var/lib/defoma/x-ttcidfont-conf.d ]; then
123 # Remove old fonts.cache-1 files
124 find /var/lib/defoma/x-ttcidfont-conf.d -name fonts.cache-1 | xargs rm -f
125fi
126
127#DEBHELPER#
128
129if [ "$1" = configure ]; then
130 # (Hacked up from Red Hat 8 fontconfig RPM)
131 # Force regeneration of all fontconfig cache files.
132 # The redirect is because fc-cache is giving warnings about ~/fc.cache
133 # the HOME setting is to avoid problems if HOME hasn't been reset
134 printf "Regenerating fonts cache... "
135 HOME=/root fc-cache -f -v 1>/var/log/fontconfig.log 2>&1 || (printf "failed.\nSee /var/log/fontconfig.log for more information.\n"; exit 1)
136 printf "done.\n"
137fi
138
139exit 0