summaryrefslogtreecommitdiffstats
path: root/abs/core/ttf-dejavu/ttf-dejavu.install
blob: f831cb161c70df69fdbff4f1929f35f38cd71fff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
configs=(20-unhint-small-dejavu-sans-mono.conf
         20-unhint-small-dejavu-sans.conf
         20-unhint-small-dejavu-serif.conf
         57-dejavu-sans-mono.conf
         57-dejavu-sans.conf
         57-dejavu-serif.conf)
post_install() {
  pushd /etc/fonts/conf.d > /dev/null
  for config in "${configs[@]}"; do
    ln -sf ../conf.avail/${config} .
  done
  popd > /dev/null
  fc-cache -fs
  mkfontscale usr/share/fonts/TTF
  mkfontdir usr/share/fonts/TTF
}

post_upgrade() {
  if [ `vercmp 2.30-2 $2` -gt 0 ]; then 
    pushd /etc/fonts/conf.d > /dev/null
    for config in "${configs[@]}"; do
      ln -sf ../conf.avail/${config} .
    done
    popd > /dev/null
  fi
  for config in /etc/fonts/conf.d/*; do
    if [ ! -f ${config} ]; then
      rm -f ${config}
    fi
  done
  fc-cache -fs
  mkfontscale usr/share/fonts/TTF
  mkfontdir usr/share/fonts/TTF
}

pre_upgrade() {
  # Link new config files not present on system yet
  pushd /etc/fonts/conf.d > /dev/null
  for config in "${configs[@]}"; do
    if [ ! -f ../conf.avail/${config} ]; then
      ln -sf ../conf.avail/${config} .
    fi
  done
  popd > /dev/null
}

post_remove() {
  pushd /etc/fonts/conf.d > /dev/null
  for config in "${configs[@]}"; do
    rm -f ${config}
  done
  popd > /dev/null
  fc-cache -fs
  mkfontscale usr/share/fonts/TTF
  mkfontdir usr/share/fonts/TTF
}