]>
Commit | Line | Data |
---|---|---|
b9d37c0b AJ |
1 | #!/bin/sh |
2 | # | |
3 | # Generate Symlinks for a set of aliases. | |
4 | # Our base content is the bundled .po translation output | |
5 | # | |
6 | # This file creates the authoritative ISO aliases. | |
7 | # | |
b9d37c0b AJ |
8 | |
9 | LN="${1}" | |
10 | RM="${2}" | |
11 | DIR="${3}" | |
12 | ALIASFILE="${4}" | |
13 | ||
14 | if ! test -f ${ALIASFILE} ; then | |
15 | echo "FATAL: Alias file ${ALIASFILE} does not exist!" | |
16 | exit 1 | |
17 | fi | |
18 | ||
4d535806 AJ |
19 | if ! test -d ${DIR} ; then |
20 | echo "WARNING: Destination directory does not exist. Nothing to do." | |
21 | exit 0 | |
22 | fi | |
23 | ||
b9d37c0b AJ |
24 | # Parse the alias file |
25 | cat ${ALIASFILE} | | |
26 | while read base aliases; do | |
27 | # file may be commented or have empty lines | |
28 | if test "${base}" = "#" || test "${base}" = ""; then | |
29 | continue; | |
30 | fi | |
31 | # split aliases based on whitespace and create a symlink for each | |
32 | # Remove and replace any pre-existing content/link | |
33 | for alia in ${aliases}; do | |
34 | ${RM} -f -r ${DIR}/${alia} || exit 1 | |
35 | ${LN} -s ${DIR}/${base} ${DIR}/${alia} || exit 1 | |
36 | done | |
37 | done |