]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Language alias linker/installer/upgrade scripts
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Jun 2009 14:20:11 +0000 (02:20 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 17 Jun 2009 14:20:11 +0000 (02:20 +1200)
alias-link.sh
  This is a script set designed to be called via make/Makefile and setup
  language codes for those languages which it would be impractical to
  bundle duplicate translated files for.
  Relies on local environment tools to be detected by automake.

make install
  - now also calls generation of aliases after existing install.
    Provided in file aliases.

make upgrade
  - cleans out legacy files from pre-3.1 and replaces with symlinks
    to the new upgraded language codes.
    Provided in file alias-upgrade.
  NP: this is a destructive process and must be manually run.

Bundle aliasing scripts and Makefile to use them with the langpack.

errors/Makefile.am
errors/alias-link.sh [new file with mode: 0755]
errors/alias-upgrade [new file with mode: 0644]
errors/aliases [new file with mode: 0644]
mksnapshot.sh

index 33d16074a2ebae613ac8bdb9a4d36e32e1e6060a..1662abb4a05a3407cade3cedcb8cb13f3df37926 100644 (file)
@@ -30,7 +30,8 @@ install-data-local:
        else \
                echo "$(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET)"; \
                $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET); \
-       fi
+       fi \
+       $(SHELL) $(srcdir)/alias-link.sh "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/aliases" || exit 1
 
 
 uninstall-local:
@@ -46,6 +47,11 @@ uninstall-local:
        @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh "$(RM)" $(DESTDIR)$(DEFAULT_STYLESHEET)
        rm -f $(DESTDIR)$(DEFAULT_STYLESHEET).default
 
+
+## Upgrade requires the new files to be pre-installed
+upgrade: install
+       $(SHELL) $(srcdir)/alias-link.sh "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/alias-upgrade" || exit 1
+
 dist-hook: translate
        for lang in $(TRANSLATIONS); do \
          if test -d $$lang ; then \
@@ -56,7 +62,9 @@ dist-hook: translate
                  || exit 1; \
          fi; \
        done; \
-       cp -p $(srcdir)/errorpage.css  $(distdir)/errorpage.css
+       for f in aliases alias-link.sh alias-upgrade $(DEFAULT_STYLESHEET); do \
+               cp -p $(srcdir)/$$f $(distdir)/`basename $$f`; \
+       done;
 
 translate:
        @if ! test -f $(top_srcdir)/errors/en.po; then \
diff --git a/errors/alias-link.sh b/errors/alias-link.sh
new file mode 100755 (executable)
index 0000000..043623c
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Generate Symlinks for a set of aliases.
+# Our base content is the bundled .po translation output
+#
+# This file creates the authoritative ISO aliases.
+#
+# INPUT:   "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/$@"
+
+LN="${1}"
+RM="${2}"
+DIR="${3}"
+ALIASFILE="${4}"
+
+if ! test -f ${ALIASFILE} ; then
+       echo "FATAL: Alias file ${ALIASFILE} does not exist!"
+       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}" = ""; then
+               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
+               ${RM} -f -r ${DIR}/${alia} || exit 1
+               ${LN} -s ${DIR}/${base} ${DIR}/${alia} || exit 1
+       done
+done
diff --git a/errors/alias-upgrade b/errors/alias-upgrade
new file mode 100644 (file)
index 0000000..a314d15
--- /dev/null
@@ -0,0 +1,33 @@
+# 3.0 Still published with the old language namings.
+# we leave these alone in case any are configured...
+az     Azerbaijani
+bg     Bulgarian
+ca     Catalan
+cz     Czech
+da     Danish
+de     German
+el     Greek
+en     English
+es     Spanish
+et     Estonian
+fi     Finnish
+fr     French
+he     Hebrew
+hu     Hungarian
+hy     Armenian
+it     Italian
+ja     Japanese
+ko     Korean
+lt     Lithuanian
+nl     Dutch
+po     Polish
+pt     Portuguese
+ro     Romanian
+ru     Russian-1251 Russian-koi8-r
+sk     Slovak
+sr     Serbian
+sv     Swedish
+tr     Turkish
+uk     Ukrainian-1251 Ukrainian-koi8-u Ukrainian-utf8
+zh-cn  Simplify_Chinese
+zh-tw  Traditional_Chinese
diff --git a/errors/aliases b/errors/aliases
new file mode 100644 (file)
index 0000000..49bf486
--- /dev/null
@@ -0,0 +1,2 @@
+en     en-nz en-au en-gb en-uk en-ca
+ru     ru-ru
index 09e74f422e65aff853e74ace10393437271444d6..b49bfe18e89b6dbfe0d385953af016b0826155eb 100755 (executable)
@@ -116,6 +116,6 @@ fi
 # Generate language-pack tarballs
 # NP: Only to be done on HEAD branch.
 if test "${VERSION}" = "3.HEAD" ; then
-       sh -c "cd $tmpdir/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${date}-langpack.tar.gz ./*/*"
+       sh -c "cd $tmpdir/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${date}-langpack.tar.gz ./*/* ./alias* ./Makefile "
        echo ${PACKAGE}-${VERSION}-${date}-langpack.tar.gz >>${tag}.out
 fi