Patch for sorting keyboard layout names and translations in debian installer
tags 259857 patch d-i
thanks
The attached patch allows the sorting of keyboard layout names,
including in localized environments.
This makes use of the Indices-xx field in debconf, which is ATM used
only by cdebconf, IIRC.
THus, this patch will work only when console-data is used from Debian
Installer, called by kbd-chooser.
The sort-keymaps scripts is a direct copy of the sort-countries script
we already use in choose-mirror.
The sort-countries script was originally written by Denis Barbier, so
the credit for it should mostly go to him.
--
diff --exclude=.svn -Nru console-data.ori/debian/rules console-data/debian/rules
--- console-data.ori/debian/rules 2004-10-27 09:48:40.000000000 +0200
+++ console-data/debian/rules 2004-10-27 18:31:32.000000000 +0200
@@ -69,7 +69,7 @@
clean:
dh_testdir
dh_testroot
- rm -rf console-data.config debian/console-data.templates ${SOURCE_DIR} ${STAMP_DIR}
+ rm -rf console-data.config debian/console-data.templates ${SOURCE_DIR} ${STAMP_DIR} debian/sort-tmp debian/locales
rm -rf debian/substvars
dh_clean
@@ -111,6 +111,10 @@
dh_consoledata -i
dh_installdebconf -i
+ # Sort keymaps (including in translations)
+ # MUST be after dh_installdebconf
+ chmod u+x ./sort-keymaps
+ ./sort-keymaps
dh_installdocs -p console-data debian/README.us-intl
install -d -m755 ${exampledir}
diff --exclude=.svn -Nru console-data.ori/sort-keymaps console-data/sort-keymaps
--- console-data.ori/sort-keymaps 1970-01-01 01:00:00.000000000 +0100
+++ console-data/sort-keymaps 2004-10-26 07:53:20.000000000 +0200
@@ -0,0 +1,47 @@
+#!/bin/sh
+[ -d debian/locales ] || mkdir debian/locales
+[ -d debian/sort-tmp ] || mkdir debian/sort-tmp
+cd debian/sort-tmp
+for package in `ls -1 ../console-keymaps-*.templates`
+do
+ pkgname=`basename $package| sed 's/\.templates//g'`
+ echo Sorting keymaps in $pkgname...
+ mkdir $pkgname || true
+ cd $pkgname
+ sed -n -e "/^Template: $pkgname\\/keymap/,/^Description:/p" ../../$pkgname/DEBIAN/templates |
+ sed -e "s/\.UTF-8:/\.UTF-8,/g" |
+ perl -p -e '
+ chomp;
+ if (m/Choices-([^.]*)\.UTF-8,/) {
+ open (OUT, "> list.$1");
+ @t = split(/, /);
+ shift(@t);
+ my $cnt = 0;
+ foreach my $name (@t) {$cnt++; print OUT "$cnt $name\n";}
+ close OUT;
+ }
+ $_="";'
+ for file in list.*
+ do
+ lang=${file#list.}
+ echo -n $lang...
+ unilang=$(grep "^$lang.*\\.UTF-8" /usr/share/i18n/SUPPORTED | sed -e 1q | sed -e 's/[@. ].*//' )
+ if [ -z "$unilang" ]; then
+ echo "Warning: lang $lang skipped because no UTF-8 variant found" 1>&2
+ else
+ [ -d ../../locales/$unilang.UTF-8 ] || localedef -c -f UTF-8 -i $unilang ../../locales/$unilang.UTF-8
+ LOCPATH=`pwd` LC_ALL=../../locales/$unilang.UTF-8 sort -k 2.1 $file | sed -e 's/ .*/, /' | tr -d '\n' | sed -e "s/^/Indices-$lang.UTF-8: /" -e 's/, $//' > sorted$file
+ echo "" >>sorted$file
+ echo Done.
+ fi
+ done
+ # Now ../../$pkgname/DEBIAN/templates must be patched: all sortedlist.*
+ # files have to be added to the $pkgname/keymap template.
+ sed -e "/$pkgname.*keymap/{n;q;}" ../../$pkgname/DEBIAN/templates >templates.tmp
+ cat sorted* >>templates.tmp
+ sed -e "/$pkgname.*keymap/!d;/$pkgname.*keymap/{:end;n;b end}" ../../$pkgname/DEBIAN/templates | sed '1,2d'>>templates.tmp
+ mv templates.tmp ../../$pkgname/DEBIAN/templates
+ cd ..
+done
+cd ../..
+# rm -r debian/locales debian/sort-tmp
Reply to: