wok-tiny view keyboard/receipt @ rev 142

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Feb 27 17:43:23 2019 +0100 (2 months ago)
parents 1a6a79b48e76
children
line source
1 # SliTaz package receipt.
3 PACKAGE="keyboard"
4 VERSION="1.0"
5 CATEGORY="base-system"
6 SHORT_DESC="keyboard, locales and timezone settings"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="http://tiny.slitaz.org/"
11 DEPENDS="base-tiny"
12 BUILD_DEPENDS="advancecomp"
14 # Rules to configure and make the package.
15 compile_rules()
16 {
17 mkdir -p $DESTDIR/usr/share/i18n $stuff
18 cd $stuff
19 for i in kbd-busybox glibc-base glibc-locale ; do
20 tazpkg get $i
21 tazpkg extract $i*
22 done
23 cp -a kbd-busybox*/fs/usr/share/kmap $DESTDIR/usr/share
24 cp -a glibc-*/fs/usr/share/i18n/locales $DESTDIR/usr/share/i18n
25 cp -a glibc-*/fs/usr/share/zoneinfo $DESTDIR/usr/share
26 cd $DESTDIR/usr/share
27 for i in i18n/locales zoneinfo ; do
28 ( cd $i; find * -type f | while read f; do
29 grep -q $f $stuff/../receipt || rm -f $f; done )
30 find $i -type d | tac | while read d; do
31 rmdir $d 2> /dev/null
32 done
33 done
34 find kmap/*.kmap i18n/locales zoneinfo | cpio -o -H newc | \
35 gzip -9 > data.cpio.gz
36 advdef -z4 data.cpio.gz
37 cd $stuff/..
38 rm -rf $stuff
39 }
41 # Rules to gen a SliTaz package suitable for Tazpkg.
42 genpkg_rules()
43 {
44 cp -a $install/. $fs/
45 }
47 config_form()
48 {
49 cat <<EOT
50 <script type="text/javascript">
52 var locale = [], timezone = [];
53 function setdefault(kbd)
54 {
55 if (locale[kbd] != 'undefined') {
56 document.getElementById("locale").value = locale[kbd];
57 }
58 if (timezone[kbd] != 'undefined') {
59 document.getElementById("timezone").value = timezone[kbd];
60 }
61 }
63 EOT
64 awk 'BEGIN { n=0 }
65 {
66 print "locale[\"" $1 "\"] = \"" $2 "\";"
67 if ($3 != "-") print "timezone[\"" $1 "\"] = \"" $3 "\";"
68 gsub("_"," ",$4)
69 name[n] = $4
70 kbd[n++] = $1
71 }
72 END {
73 print "</script>"
74 print "<table>"
75 print "<tr><td>Keyboard</td>"
76 print "<td><select name=\"KEYBOARD\" onChange=\"setdefault(value)\">"
77 for (i=0; i < n; i++)
78 print " <option value=\"" kbd[i] "\">" name[i] "</option>"
79 }' <<EOT | sed "s|value=\"$KEYBOARD\"|& selected=\"selected\"|"
80 br-abnt2 pt_BR America/Sao_Paulo Brasil_(abnt2)
81 us-acentos pt_BR America/Sao_Paulo Brasil_(us-acentos)
82 cz-lat2 cs_CZ Europe/Prague Cesky
83 dk-latin1 da_DK Europe/Copenhagen Danso
84 de-latin1 de_DE Europe/Berlin Deutsch
85 de_CH-latin1 de_CH Europe/Zurich Deutsch_Schweiz
86 sg-latin1 de_CH Europe/Zurich Deutsch_Schweiz_(sg)
87 uk en_GB Europe/London English_UK
88 us en_US America/New_York English_US
89 us-acentos en_US America/New_York English_US_(acentos)
90 dvorak en_US America/New_York English_US_(dvorak)
91 dvorak-l en_US America/New_York English_US_(dvorak-l)
92 dvorak-r en_US America/New_York English_US_(dvorak-r)
93 es es_ES Europe/Madrid Espanol
94 fr-latin1 fr_FR Europe/Paris Francais
95 be-latin1 fr_BE Europe/Brussels Francais_Belgique
96 cf fr_CA America/Montreal Francais_Canada
97 fr_CH-latin1 fr_CH Europe/Zurich Francais_Suisse
98 croat hr_HR Europe/Zagreb Hrvatski
99 is-latin1 is_IS Atlantic/Reykjavik Islenska
100 it it_IT Europe/Rome Italiano
101 jp106 ja_JP Asia/Tokyo Japanese
102 hu hu_HU Europe/Budapest Magyar
103 nl2 nl_NL Europe/Amsterdam Nederlands
104 no-latin1 nb_NO Europe/Oslo Norsk_(Bokmal)
105 no-latin1 nn_NO Europe/Oslo Norsk_(Nynorsk)
106 pl2 pl_PL Europe/Warsaw Polski
107 pt-latin1 pt_PT Europe/Lisbon Portugues
108 ru ru_RU Europe/Moscow Russian
109 slovene sl_SI Europe/Ljubljan Slovenski
110 fi-latin1 fi_FI Europe/Helsinki Suomi
111 se-lat6 sv_SE Europe/Stockholm Svenska
112 trq tr_TR Asia/Istanbul Turkce
113 tr_q-latin5 tr_TR Asia/Istanbul Turkce_(latin5)
114 EOT
115 cat <<EOT
116 </select></td>
117 </tr>
118 <tr>
119 <td>Locale</td>
120 <td><select name="LOCALE" id="locale">
121 EOT
122 ( cd /usr/share/i18n/locales ; ls ??_* ) | \
123 sed "s|.*| <option>&</option>|;s|>$LOCALE<| selected=\"selected\"&|"
124 cat <<EOT
125 </select></td>
126 </tr>
127 <tr>
128 <td>Timezone</td>
129 <td><select name="TIMEZONE" id="timezone">
130 EOT
131 ( cd /usr/share/zoneinfo ; find */ -type f ) | \
132 sed "s|.*| <option>&</option>|;s|>$TIMEZONE<| selected=\"selected\"&|"
133 cat <<EOT
134 </select></td>
135 </tr>
136 </table>
137 <input type="checkbox" name="USECMDLINE" ${USECMDLINE:+checked=checked }value="yes">
138 Use the kernel command line arguments <b><i>kmap=</i></b>,
139 <b><i>lang=</i></b> and <b><i>tz=</i></b> (+200Kb).
140 EOT
141 }
143 post_install()
144 {
145 if [ "$USECMDLINE" = "yes" ]; then
146 mkdir $1/bin
147 cat > $1/bin/loadkmap <<EOT
148 #!/bin/sh
150 cd /usr/share
151 for i in \$(cat /proc/cmdline); do
152 j=\${i#*=}
153 case "\$i" in
154 kmap=*) d=kmap
155 j=\$j.kmap ;;
156 lang=*) d=i18n/locales
157 echo -e "LANG=\$j\nLC_ALL=\$j" > /etc/locale.conf ;;
158 tz=*) d=zoneinfo
159 echo "\$j" > /etc/TZ ;;
160 *) continue
161 esac
162 rm -rf \$d
163 zcat data.cpio.gz | cpio -id \$d/\$j 2>/dev/null
164 done
165 cat kmap/* | busybox loadkmap
166 rm -f /bin/loadkmap data.cpio.gz
167 EOT
168 chmod +x $1/bin/loadkmap
169 else
170 rm -f $1/usr/share/data.cpio.gz
171 fi
172 for i in $1/usr/share/i18n/locales/* ; do
173 [ $i = $1/usr/share/i18n/locales/$LOCALE ] || rm $i
174 done
175 [ -n "$LOCALE" ] && cat > $1/etc/locale.conf <<EOT
176 LANG=$LOCALE
177 LC_ALL=$LOCALE
178 EOT
179 find $1/usr/share/zoneinfo -type f | while read i; do
180 [ $i = $1/usr/share/zoneinfo/$TIMEZONE ] || rm $i
181 done
182 rmdir $1/usr/share/zoneinfo/* 2> /dev/null
183 [ -n "$TIMEZONE" ] && echo "$TIMEZONE" > $1/etc/TZ
184 for i in $1/usr/share/kmap/*.kmap ; do
185 [ $i = $1/usr/share/kmap/$KEYBOARD.kmap ] || rm $i
186 done
187 }