File: python-django-countries.postinst

package info (click to toggle)
django-countries 3.4.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,272 kB
  • ctags: 390
  • sloc: python: 1,894; sh: 44; makefile: 26
file content (28 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

set -eu

build_locale_symlinks ()
{
    local path dest file
    # Remove existing symlink farm. We will recreate it immediately.
    rm -rf /usr/share/python-django-countries/locale/*
    for file in /usr/share/locale/*/LC_MESSAGES/iso_3166.mo; do
        # Create the necessary directory structure for each language.
        path=$(dirname /usr/share/python-django-countries/locale/${file#/usr/share/locale/})
        mkdir -p ${path}
        # Create the symlink with an absolute target path (iso_3166.mo -> django.mo).
        dest=${path}/django.mo
        ln -s ../../../../${file#/usr/share/} ${dest}
    done
}

if [ "$1" = "configure" ]; then
    build_locale_symlinks
elif [ "$1" = "triggered" ]; then
    # iso-codes has been updated
    build_locale_symlinks
    exit 0
fi

#DEBHELPER#