summaryrefslogtreecommitdiff
path: root/src/grp-locale
diff options
context:
space:
mode:
Diffstat (limited to 'src/grp-locale')
-rw-r--r--src/grp-locale/.gitignore1
-rw-r--r--src/grp-locale/Makefile67
-rw-r--r--src/grp-locale/localectl/Makefile45
-rw-r--r--src/grp-locale/localectl/localectl.c (renamed from src/grp-locale/localectl.c)0
-rw-r--r--src/grp-locale/localectl/localectl.completion.bash92
-rw-r--r--src/grp-locale/localectl/localectl.completion.zsh93
-rw-r--r--src/grp-locale/systemd-localed/.gitignore1
-rw-r--r--src/grp-locale/systemd-localed/Makefile79
-rw-r--r--src/grp-locale/systemd-localed/kbd-model-map (renamed from src/grp-locale/kbd-model-map)0
-rw-r--r--src/grp-locale/systemd-localed/language-fallback-map (renamed from src/grp-locale/language-fallback-map)0
-rw-r--r--src/grp-locale/systemd-localed/localed.c (renamed from src/grp-locale/localed.c)0
-rw-r--r--src/grp-locale/systemd-localed/org.freedesktop.locale1.conf (renamed from src/grp-locale/org.freedesktop.locale1.conf)0
-rw-r--r--src/grp-locale/systemd-localed/org.freedesktop.locale1.policy.in (renamed from src/grp-locale/org.freedesktop.locale1.policy.in)0
-rw-r--r--src/grp-locale/systemd-localed/org.freedesktop.locale1.service (renamed from src/grp-locale/org.freedesktop.locale1.service)0
14 files changed, 311 insertions, 67 deletions
diff --git a/src/grp-locale/.gitignore b/src/grp-locale/.gitignore
deleted file mode 100644
index b1e0ba755e..0000000000
--- a/src/grp-locale/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-org.freedesktop.locale1.policy
diff --git a/src/grp-locale/Makefile b/src/grp-locale/Makefile
index 013c5289a5..6dc11dc2d8 100644
--- a/src/grp-locale/Makefile
+++ b/src/grp-locale/Makefile
@@ -23,71 +23,6 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-ifneq ($(ENABLE_LOCALED),)
-systemd_localed_SOURCES = \
- src/locale/localed.c
-
-systemd_localed_LDADD = \
- libshared.la \
- -ldl
-
-systemd_localed_CFLAGS = \
- $(AM_CFLAGS) \
- $(XKBCOMMON_CFLAGS)
-
-nodist_systemunit_DATA += \
- units/systemd-localed.service
-
-dist_systemunit_DATA_busnames += \
- units/org.freedesktop.locale1.busname
-
-rootlibexec_PROGRAMS += \
- systemd-localed
-
-dist_dbuspolicy_DATA += \
- src/locale/org.freedesktop.locale1.conf
-
-dist_dbussystemservice_DATA += \
- src/locale/org.freedesktop.locale1.service
-
-polkitpolicy_files += \
- src/locale/org.freedesktop.locale1.policy
-
-SYSTEM_UNIT_ALIASES += \
- systemd-localed.service dbus-org.freedesktop.locale1.service
-
-BUSNAMES_TARGET_WANTS += \
- org.freedesktop.locale1.busname
-
-dist_pkgdata_DATA = \
- src/locale/kbd-model-map \
- src/locale/language-fallback-map
-
-localectl_SOURCES = \
- src/locale/localectl.c
-
-localectl_LDADD = \
- libshared.la
-
-bin_PROGRAMS += \
- localectl
-
-dist_bashcompletion_data += \
- shell-completion/bash/localectl
-
-dist_zshcompletion_data += \
- shell-completion/zsh/_localectl
-endif # ENABLE_LOCALED
-
-.PHONY: update-kbd-model-map
-
-polkitpolicy_in_files += \
- src/locale/org.freedesktop.locale1.policy.in
-
-EXTRA_DIST += \
- units/systemd-localed.service.in
-
-sd.CPPFLAGS += -DSYSTEMD_KBD_MODEL_MAP=\"$(pkgdatadir)/kbd-model-map\"
-sd.CPPFLAGS += -DSYSTEMD_LANGUAGE_FALLBACK_MAP=\"$(pkgdatadir)/language-fallback-map\"
+nested.subdirs += systemd-localed localectl
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-locale/localectl/Makefile b/src/grp-locale/localectl/Makefile
new file mode 100644
index 0000000000..d0023df124
--- /dev/null
+++ b/src/grp-locale/localectl/Makefile
@@ -0,0 +1,45 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+ifneq ($(ENABLE_LOCALED),)
+
+localectl_SOURCES = \
+ src/locale/localectl.c
+
+localectl_LDADD = \
+ libshared.la
+
+bin_PROGRAMS += \
+ localectl
+
+dist_bashcompletion_data += \
+ shell-completion/bash/localectl
+
+dist_zshcompletion_data += \
+ shell-completion/zsh/_localectl
+
+endif # ENABLE_LOCALED
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-locale/localectl.c b/src/grp-locale/localectl/localectl.c
index 72ac1c0303..72ac1c0303 100644
--- a/src/grp-locale/localectl.c
+++ b/src/grp-locale/localectl/localectl.c
diff --git a/src/grp-locale/localectl/localectl.completion.bash b/src/grp-locale/localectl/localectl.completion.bash
new file mode 100644
index 0000000000..e0c06a794e
--- /dev/null
+++ b/src/grp-locale/localectl/localectl.completion.bash
@@ -0,0 +1,92 @@
+# localectl(1) completion -*- shell-script -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010 Ran Benita
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+__contains_word () {
+ local w word=$1; shift
+ for w in "$@"; do
+ [[ $w = "$word" ]] && return
+ done
+}
+
+__locale_fields=( LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
+ LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \
+ LC_NAME LC_ADDRESS LC_TELEPHONE \
+ LC_MEASUREMENT LC_IDENTIFICATION )
+# LC_ALL is omitted on purpose
+
+_localectl() {
+ local i verb comps locale_vals
+ local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
+ local OPTS='-h --help --version --no-convert --no-pager --no-ask-password
+ -H --host --machine'
+
+ if __contains_word "$prev" $OPTS; then
+ case $prev in
+ --host|-H)
+ comps=''
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+ fi
+
+ if [[ $cur = -* ]]; then
+ COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
+ return 0
+ fi
+
+ local -A VERBS=(
+ [STANDALONE]='status list-locales list-keymaps'
+ [LOCALES]='set-locale'
+ [KEYMAPS]='set-keymap'
+ [X11]='set-x11-keymap'
+ )
+
+ for ((i=0; i < COMP_CWORD; i++)); do
+ if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]}; then
+ verb=${COMP_WORDS[i]}
+ break
+ fi
+ done
+
+ if [[ -z $verb ]]; then
+ comps=${VERBS[*]}
+ elif __contains_word "$verb" ${VERBS[LOCALES]}; then
+ if [[ $cur = *=* ]]; then
+ mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null)
+ COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "${cur#=}") )
+ elif [[ $prev = "=" ]]; then
+ mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null)
+ COMPREPLY=( $(compgen -W '${locale_vals[*]}' -- "$cur") )
+ else
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W '${__locale_fields[*]}' -S= -- "$cur") )
+ fi
+ return 0
+ elif __contains_word "$verb" ${VERBS[KEYMAPS]}; then
+ comps=$(command localectl list-keymaps)
+ elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[X11]}; then
+ comps=''
+ fi
+
+ COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+ return 0
+}
+
+complete -F _localectl localectl
diff --git a/src/grp-locale/localectl/localectl.completion.zsh b/src/grp-locale/localectl/localectl.completion.zsh
new file mode 100644
index 0000000000..d8af4d1863
--- /dev/null
+++ b/src/grp-locale/localectl/localectl.completion.zsh
@@ -0,0 +1,93 @@
+#compdef localectl
+
+_localectl_set-locale() {
+ local -a _locales locale_fields
+ locale_fields=(LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
+ LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER \
+ LC_NAME LC_ADDRESS LC_TELEPHONE \
+ LC_MEASUREMENT LC_IDENTIFICATION)
+ # LC_ALL is omitted on purpose
+
+ local expl suf
+ _locales=( ${(f)"$(_call_program locales "$service" list-locales)"} )
+ compset -P1 '*='
+ if [[ -prefix 1 *\= ]]; then
+ local conf=${PREFIX%%\=*}
+ _wanted locales expl "locales configs" \
+ _combination localeconfs confs=$conf locales "$@" -
+ else
+ compadd -S '=' $locale_fields
+ fi
+}
+
+_localectl_set-keymap() {
+ local -a _keymaps
+ if (( CURRENT <= 3 )); then
+ _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} )
+ _describe keymaps _keymaps
+ else
+ _message "no more options"
+ fi
+}
+
+_localectl_set-x11-keymap() {
+ if (( $+commands[pkg-config] )); then
+ local -a _file _layout _model _variant _options
+ local _xorg_lst
+ _xorg_lst=${"$($commands[pkg-config] xkeyboard-config --variable=xkb_base)"}
+ _file=( ${(ps:\n\!:)"$(<$_xorg_lst/rules/xorg.lst)"} )
+ _layout=( ${${${(M)${(f)_file[1]}:# *}# }%% *} )
+ _model=( ${${${(M)${(f)_file[2]}:# *}# }%% *} )
+ _variant=( ${${${(M)${(f)_file[3]}:# *}# }%% *} )
+ _options=( ${${${(M)${(f)_file[4]}:# *}# }%% *} )
+ #_layout=( ${(f)"$( echo $_file[1] | awk '/^ / {print $1}' )"} )
+ #_model=( ${(f)"$(echo $_file[2] | awk '/^ / {print $1}')"} )
+ #_variant=( ${(f)"$(echo $_file[3] | awk '/^ / {print $1}')"} )
+ #_options=( ${(f)"$(echo ${_file[4]//:/\\:} | awk '/^ / {print $1}')"} )
+
+ case $CURRENT in
+ 2) _describe layouts _layout ;;
+ 3) _describe models _model;;
+ 4) _describe variants _variant;;
+ 5) _describe options _options;;
+ *) _message "no more options"
+ esac
+ fi
+}
+
+_localectl_command() {
+ local -a _localectl_cmds
+ _localectl_cmds=(
+ 'status:Show current locale settings'
+ 'set-locale:Set system locale'
+ 'list-locales:Show known locales'
+ 'set-keymap:Set virtual console keyboard mapping'
+ 'list-keymaps:Show known virtual console keyboard mappings'
+ 'set-x11-keymap:Set X11 keyboard mapping'
+ 'list-x11-keymap-models:Show known X11 keyboard mapping models'
+ 'list-x11-keymap-layouts:Show known X11 keyboard mapping layouts'
+ 'list-x11-keymap-variants:Show known X11 keyboard mapping variants'
+ 'list-x11-keymap-options:Show known X11 keyboard mapping options'
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'localectl command' _localectl_cmds
+ else
+ local curcontext="$curcontext"
+ cmd="${${_localectl_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $+functions[_localectl_$cmd] )); then
+ _localectl_$cmd
+ else
+ _message "unknown localectl command: $words[1]"
+ fi
+ fi
+}
+
+_arguments \
+ {-h,--help}'[Show this help]' \
+ '--version[Show package version]' \
+ "--no-convert[Don't convert keyboard mappings]" \
+ '--no-pager[Do not pipe output into a pager]' \
+ '--no-ask-password[Do not prompt for password]' \
+ {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
+ {-M+,--machine=}'[Operate on local container]:machine' \
+ '*::localectl commands:_localectl_command'
diff --git a/src/grp-locale/systemd-localed/.gitignore b/src/grp-locale/systemd-localed/.gitignore
new file mode 100644
index 0000000000..6d9d6089c0
--- /dev/null
+++ b/src/grp-locale/systemd-localed/.gitignore
@@ -0,0 +1 @@
+/org.freedesktop.locale1.policy
diff --git a/src/grp-locale/systemd-localed/Makefile b/src/grp-locale/systemd-localed/Makefile
new file mode 100644
index 0000000000..de38bb8576
--- /dev/null
+++ b/src/grp-locale/systemd-localed/Makefile
@@ -0,0 +1,79 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+ifneq ($(ENABLE_LOCALED),)
+systemd_localed_SOURCES = \
+ src/locale/localed.c
+
+systemd_localed_LDADD = \
+ libshared.la \
+ -ldl
+
+systemd_localed_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(XKBCOMMON_CFLAGS)
+
+nodist_systemunit_DATA += \
+ units/systemd-localed.service
+
+dist_systemunit_DATA_busnames += \
+ units/org.freedesktop.locale1.busname
+
+rootlibexec_PROGRAMS += \
+ systemd-localed
+
+dist_dbuspolicy_DATA += \
+ src/locale/org.freedesktop.locale1.conf
+
+dist_dbussystemservice_DATA += \
+ src/locale/org.freedesktop.locale1.service
+
+polkitpolicy_files += \
+ src/locale/org.freedesktop.locale1.policy
+
+SYSTEM_UNIT_ALIASES += \
+ systemd-localed.service dbus-org.freedesktop.locale1.service
+
+BUSNAMES_TARGET_WANTS += \
+ org.freedesktop.locale1.busname
+
+dist_pkgdata_DATA = \
+ src/locale/kbd-model-map \
+ src/locale/language-fallback-map
+
+endif # ENABLE_LOCALED
+
+.PHONY: update-kbd-model-map
+
+polkitpolicy_in_files += \
+ src/locale/org.freedesktop.locale1.policy.in
+
+EXTRA_DIST += \
+ units/systemd-localed.service.in
+
+sd.CPPFLAGS += -DSYSTEMD_KBD_MODEL_MAP=\"$(pkgdatadir)/kbd-model-map\"
+sd.CPPFLAGS += -DSYSTEMD_LANGUAGE_FALLBACK_MAP=\"$(pkgdatadir)/language-fallback-map\"
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-locale/kbd-model-map b/src/grp-locale/systemd-localed/kbd-model-map
index 8fa984f83b..8fa984f83b 100644
--- a/src/grp-locale/kbd-model-map
+++ b/src/grp-locale/systemd-localed/kbd-model-map
diff --git a/src/grp-locale/language-fallback-map b/src/grp-locale/systemd-localed/language-fallback-map
index d0b02a6b98..d0b02a6b98 100644
--- a/src/grp-locale/language-fallback-map
+++ b/src/grp-locale/systemd-localed/language-fallback-map
diff --git a/src/grp-locale/localed.c b/src/grp-locale/systemd-localed/localed.c
index 7bb7f1cf34..7bb7f1cf34 100644
--- a/src/grp-locale/localed.c
+++ b/src/grp-locale/systemd-localed/localed.c
diff --git a/src/grp-locale/org.freedesktop.locale1.conf b/src/grp-locale/systemd-localed/org.freedesktop.locale1.conf
index 79d0ecd2bb..79d0ecd2bb 100644
--- a/src/grp-locale/org.freedesktop.locale1.conf
+++ b/src/grp-locale/systemd-localed/org.freedesktop.locale1.conf
diff --git a/src/grp-locale/org.freedesktop.locale1.policy.in b/src/grp-locale/systemd-localed/org.freedesktop.locale1.policy.in
index df63845e9b..df63845e9b 100644
--- a/src/grp-locale/org.freedesktop.locale1.policy.in
+++ b/src/grp-locale/systemd-localed/org.freedesktop.locale1.policy.in
diff --git a/src/grp-locale/org.freedesktop.locale1.service b/src/grp-locale/systemd-localed/org.freedesktop.locale1.service
index 025f9a0fc2..025f9a0fc2 100644
--- a/src/grp-locale/org.freedesktop.locale1.service
+++ b/src/grp-locale/systemd-localed/org.freedesktop.locale1.service