diff --git a/doc/features.txt b/doc/features.txt index 89a0507a..568c6755 100644 --- a/doc/features.txt +++ b/doc/features.txt @@ -14,7 +14,8 @@ удобно для анализа и обновления (и в отличие от _m-p-d_ -- нет вынужденной необходимости либо контролировать включение нужных фич "вручную" в скриптах по косвенным признакам, либо выносить -их в пакеты installer-feature-*). +их в пакеты installer-feature-*); также возможно добиться большей +степени интеграции по данным (например, язык gfxboot и LiveCD). Создание и упаковку installer-feature-* можно рекомендовать, если: diff --git a/features.in/l10n/README b/features.in/l10n/README new file mode 100644 index 00000000..7f5a2208 --- /dev/null +++ b/features.in/l10n/README @@ -0,0 +1 @@ +Эта фича занимается поддержкой локализации (l10n). diff --git a/features.in/l10n/config.mk b/features.in/l10n/config.mk new file mode 100644 index 00000000..af960847 --- /dev/null +++ b/features.in/l10n/config.mk @@ -0,0 +1,37 @@ +# install locales +# setup locale +# setup console keyboard (kbd) +# setup X11 keyboard (xkb) +# install/setup additional packages + +# TODO: KEYMAP for default keymap? +use/l10n: + @$(call add_feature) + @$(call add,STAGE2_BOOTARGS,lang=$$(LOCALE)) + @$(call add,THE_PACKAGES,glibc-locales) + @$(call add,LOCALES,en_US) + @$(call add,XKB_KEYMAPS,us) + @$(call xport,LOCALE) + @$(call xport,LOCALES) + @$(call xport,XKB_KEYMAPS) + @$(call xport,XKB_VARIANTS) + @$(call xport,XKB_SWITCH) + @$(call xport,XKB_LED) + +# see also alterator-sysconfig backend +use/l10n/xkb/switch/ctrl_shift: use/l10n + @$(call set,XKB_SWITCH,grp:ctrl_shift_toggle) + +use/l10n/xkb/led/scroll: use/l10n + @$(call set,XKB_LED,grp_led:scroll) + +# FIXME: derive from locale by default if possible +use/l10n/ru_RU: use/l10n/xkb/switch/ctrl_shift use/l10n/xkb/led/scroll + @$(call add,LOCALES,ru_RU) + @$(call set,LOCALE,ru_RU) + @$(call add,XKB_KEYMAPS,ru) + @$(call set,KEYTABLE,ruwin_ct_sh-UTF-8) + +# NB: BOOT_LANG is used within mkimage internally +use/l10n/default/ru_RU: use/l10n/ru_RU + @$(call set,GLOBAL_BOOT_LANG,ru_RU) diff --git a/features.in/l10n/live/image-scripts.d/50-l10n-kbd b/features.in/l10n/live/image-scripts.d/50-l10n-kbd new file mode 100755 index 00000000..36b66194 --- /dev/null +++ b/features.in/l10n/live/image-scripts.d/50-l10n-kbd @@ -0,0 +1,17 @@ +#!/bin/sh +# partial port of livecd-setlocale (kbd bits) + +CONFIG=/etc/sysconfig/keyboard + +# Requires: console-scripts +if [ -s "$CONFIG" ]; then + echo "** l10n-kbd: expected $CONFIG to be an empty file" >&2 + exit 0 +fi + +if [ -z "$GLOBAL_KEYTABLE" ]; then + echo "** l10n-kbd: empty GLOBAL_KEYTABLE" >&2 + exit 0 +fi + +echo "KEYTABLE=$GLOBAL_KEYTABLE" > "$CONFIG" diff --git a/features.in/l10n/live/image-scripts.d/50-l10n-xkb b/features.in/l10n/live/image-scripts.d/50-l10n-xkb new file mode 100755 index 00000000..18b87338 --- /dev/null +++ b/features.in/l10n/live/image-scripts.d/50-l10n-xkb @@ -0,0 +1,19 @@ +#!/bin/sh +# partial port of livecd-setlocale (xkb bits) + +PREFIX=/etc/X11/xinit + +# Requires: xinitrc +if [ ! -d "$PREFIX" ]; then + echo "** l10n-xkb: expected $PREFIX to exist (xinitrc)" >&2 + exit 0 +fi + +if [ -z "$GLOBAL_XKB_VARIANTS" -o -z "$GLOBAL_XKB_KEYMAPS" ]; then + echo "** l10n-xkb: empty GLOBAL_XKB_VARIANTS/GLOBAL_XKB_KEYMAPS" >&2 + exit 0 +fi + +echo "-option $GLOBAL_XKB_SWITCH${GLOBAL_XKB_LED:+,$GLOBAL_XKB_LED} \ +${GLOBAL_XKB_VARIANTS:+-variant $GLOBAL_XKB_VARIANTS} \ +-layout $GLOBAL_XKB_KEYMAPS" > "$PREFIX"/Xkbmap diff --git a/features.in/l10n/live/lib/50-l10n.mk b/features.in/l10n/live/lib/50-l10n.mk new file mode 100644 index 00000000..77d67d61 --- /dev/null +++ b/features.in/l10n/live/lib/50-l10n.mk @@ -0,0 +1,15 @@ +# supplement live with keyboard layout setup + +XKB_KEYMAPS := $(subst $(SPACE),$(COMMA),$(XKB_KEYMAPS)) + +# handle the layouts with a specific variant in the wild +XKB_VARIANTS := $(subst ru,winkeys, \ + $(subst ua,winkeys, \ + $(subst be,winkeys, \ + $(subst us,,$(XKB_KEYMAPS))))) + +debug:: + @echo "** live: LOCALES: $(LOCALES)" + @echo "** live: LOCALE: $(LOCALE)" + @echo "** live: XKB_KEYMAPS: $(XKB_KEYMAPS)" + @echo "** live: XKB_VARIANTS: $(XKB_VARIANTS)" diff --git a/features.in/live/config.mk b/features.in/live/config.mk index 49f40ca0..402a6f8f 100644 --- a/features.in/live/config.mk +++ b/features.in/live/config.mk @@ -42,7 +42,7 @@ use/live/x11: use/live/base use/syslinux/localboot.cfg \ # this target specifically pulls free xorg drivers in (and a few more bits); # a browser is requested too, the recommended one can be overridden downstream use/live/desktop: use/live/x11 use/x11/xorg use/x11/wacom \ - use/browser/firefox/live use/xdg-user-dirs/deep +vmguest; @: + use/l10n use/browser/firefox/live use/xdg-user-dirs/deep +vmguest; @: # preconfigure apt for both live and installed-from-live systems use/live/repo: use/live @@ -78,6 +78,8 @@ use/live/nodm: use/live/.x11 use/live/hooks: use/live @$(call add,LIVE_PACKAGES,livecd-run-hooks) -# a crude hack to make sure Russian is supported in a particular image -use/live/ru: use/live - @$(call add,LIVE_PACKAGES,livecd-ru) +# a crude hack to make sure Russian is the default in a particular image +use/live/ru: use/live use/l10n/default/ru_RU; @: + +use/live/sound: use/live + @$(call add,LIVE_PACKAGES,amixer alsa-utils aplay udev-alsa) diff --git a/image.in/functions.mk b/image.in/functions.mk index 8148c47a..187e4f74 100644 --- a/image.in/functions.mk +++ b/image.in/functions.mk @@ -19,6 +19,7 @@ map = $(foreach a,$(2),$(call $(1),$(a))) # kernel package list generation; see also #24669 NULL := SPACE := $(NULL) # the officially documented way of getting a space +COMMA := , list2re = $(subst $(SPACE),|,$(strip $(1)))