Correctly handle cases of deprecated locales which are supposed

to have backward compatibility symbolic links.

This code should check existence of deprecated locales and
fix them using following scheme:

. if new locale directory exisists and is a symlink -- remove it
. if old locale directory exists and not a symlink -- rename it to
  its new name

This should allow to mtree(1) and existing locale aliases make(1)
rules to setup locale dirs correctly (avoid self-referenced symlinks)

BTW, this commit brings in backward compatibility support for ru_SU
locales (aliased to appropriate ru_RU ones).
This commit is contained in:
Alexey Zelkin 2002-01-08 13:42:52 +00:00
parent af1e766495
commit 688a6139bd
2 changed files with 24 additions and 0 deletions

View File

@ -166,6 +166,19 @@ distribution:
.endif
distrib-dirs:
-set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
while [ $$# -gt 0 ] ; \
do \
for dir in /usr/share/locale \
/usr/share/nls \
/usr/local/share/nls; \
do \
test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
test -L "$$2" && rm -rf "$$2"; \
test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
done; \
shift; shift; \
done
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr

11
etc/locale.deprecated Normal file
View File

@ -0,0 +1,11 @@
# $FreeBSD$
#
# List of deprecated locales
#
# Make sure that deprecated locale directories and their replacements
# are set up correctly.
#
ru_SU.KOI8-R ru_RU.KOI8-R
ru_SU.ISO_8859-1 ru_RU.ISO8859-1
ru_SU.CP866 ru_RU.CP866
ru_RU.ISO_8859-1 ru_RU.ISO8859-1