]>
Commit | Line | Data |
---|---|---|
b9d37c0b | 1 | #!/bin/sh |
8ef1f381 | 2 | # |
f70aedc4 | 3 | ## Copyright (C) 1996-2021 The Squid Software Foundation and contributors |
8ef1f381 AJ |
4 | ## |
5 | ## Squid software is distributed under GPLv2+ license and includes | |
6 | ## contributions from numerous individuals and organizations. | |
7 | ## Please see the COPYING and CONTRIBUTORS files for details. | |
8 | ## | |
9 | ||
b9d37c0b AJ |
10 | # |
11 | # Generate Symlinks for a set of aliases. | |
12 | # Our base content is the bundled .po translation output | |
13 | # | |
14 | # This file creates the authoritative ISO aliases. | |
15 | # | |
b9d37c0b AJ |
16 | |
17 | LN="${1}" | |
18 | RM="${2}" | |
19 | DIR="${3}" | |
20 | ALIASFILE="${4}" | |
21 | ||
22 | if ! test -f ${ALIASFILE} ; then | |
23 | echo "FATAL: Alias file ${ALIASFILE} does not exist!" | |
24 | exit 1 | |
25 | fi | |
26 | ||
4d535806 AJ |
27 | if ! test -d ${DIR} ; then |
28 | echo "WARNING: Destination directory does not exist. Nothing to do." | |
29 | exit 0 | |
30 | fi | |
31 | ||
b9d37c0b AJ |
32 | # Parse the alias file |
33 | cat ${ALIASFILE} | | |
34 | while read base aliases; do | |
35 | # file may be commented or have empty lines | |
36 | if test "${base}" = "#" || test "${base}" = ""; then | |
37 | continue; | |
38 | fi | |
fe7fb192 AJ |
39 | # ignore destination languages that do not exist. (no dead links) |
40 | if ! test -x ${DIR}/${base} ; then | |
41 | echo "WARNING: ${base} translations do not exist. Nothing to do for: ${aliases}" | |
42 | continue; | |
43 | fi | |
44 | ||
b9d37c0b AJ |
45 | # split aliases based on whitespace and create a symlink for each |
46 | # Remove and replace any pre-existing content/link | |
47 | for alia in ${aliases}; do | |
48 | ${RM} -f -r ${DIR}/${alia} || exit 1 | |
ddb7ada1 | 49 | ${LN} -s ${base} ${DIR}/${alia} || exit 1 |
b9d37c0b AJ |
50 | done |
51 | done |