mirror of
https://abf.rosa.ru/djam/ibus.git
synced 2025-02-23 17:52:52 +00:00
34 lines
1.7 KiB
Text
34 lines
1.7 KiB
Text
#============================================================
|
|
# usage: %post_ibus_register_engine pinyin zh
|
|
#============================================================
|
|
%post_ibus_register_engine() \
|
|
key="/desktop/ibus/general/preload_engines" \
|
|
if [ "$1" = "1" -a `locale -a|grep %{2} |wc -l` -gt 0 ]; then \
|
|
current_value=$(%{_gconftool_bin} --get ${key} 2>/dev/null); \
|
|
current_value=${current_value/[/}; \
|
|
current_value=${current_value/]/}; \
|
|
if [ -n "${current_value}" ]; then \
|
|
new_value="${current_value},"; \
|
|
fi \
|
|
new_value="${new_value}%{1}"; \
|
|
new_value="[${new_value}]"; \
|
|
%{_gconftool_bin} --direct --config-source xml:readwrite:%{_sysconfdir}/gconf/gconf.xml.defaults --set $key --type list --list-type=string "${new_value}"; \
|
|
fi
|
|
|
|
#============================================================
|
|
# usage: %preun_ibus_unregister_engine pinyin
|
|
#============================================================
|
|
%preun_ibus_unregister_engine() \
|
|
key="/desktop/ibus/general/preload_engines" \
|
|
if [ "$1" = "0" ]; then \
|
|
current_value=$(%{_gconftool_bin} --get ${key} 2>/dev/null); \
|
|
current_value=${current_value/[/}; \
|
|
current_value=${current_value/]/}; \
|
|
new_value=$(echo $current_value | tr ',' '\\n' | grep -v ^%{1}$ |tr '\\n' ',' | sed 's/,$//'); \
|
|
if [ -z ${new_value} ]; then \
|
|
%{_gconftool_bin} --direct --config-source xml:readwrite:%{_sysconfdir}/gconf/gconf.xml.defaults --unset $key; \
|
|
else \
|
|
new_value="[${new_value}]"; \
|
|
%{_gconftool_bin} --direct --config-source xml:readwrite:%{_sysconfdir}/gconf/gconf.xml.defaults --set $key --type list --list-type=string "${new_value}"; \
|
|
fi \
|
|
fi
|