File: generate-linkfile.sh

package info (click to toggle)
squid-langpack 20220130-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 8,560 kB
  • sloc: sh: 45; makefile: 30
file content (35 lines) | stat: -rwxr-xr-x 916 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
29
30
31
32
33
34
35
#!/bin/sh
#
# Generate dh_link data file
# Our base content is the bundled .po translation output
#
# This file creates the authoritative ISO aliases.
#

DIR="/usr/share/squid-langpack"
ALIASFILE="${1}"

if ! test -f ${ALIASFILE} ; then
	echo "FATAL: Alias file ${ALIASFILE} does not exist!" >&2
	exit 1
fi

# Parse the alias file
cat ${ALIASFILE} |
while read base aliases; do
	# file may be commented or have empty lines
	if test "${base}" = "#" || test "${base}" = "##" || test "${base}" = ""; then
		continue;
	fi
	# ignore destination languages that do not exist. (no dead links)
	if ! test -x ../${base} ; then
		echo "WARNING: ${base} translations do not exist. Nothing to do for: ${aliases}" >&2
		continue;
	fi

	# split aliases based on whitespace and create a symlink for each
	# Remove and replace any pre-existing content/link
	for alia in ${aliases}; do
		echo ${DIR}/${base} ${DIR}/${alia}
	done
done