Package list mozc / 5680cd0
Clean up and add comment to script YOSHINO Yoshihito 4 months ago
1 changed file(s) with 20 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
00 #!/bin/sh
11
2 # If ibus-mozc is removed but not purged, keep hands off :-)
23 dpkg-query -l ibus-mozc 2>/dev/null | grep -q ^ii || exit 0
4
5 # If non-ibus IM framework is set-up (by im-config etc.), keep hands off :-)
36 env | grep -E '^(XMODIFIERS|GTK_IM_MODULE|QT_IM_MODULE|CLUTTER_IM_MODULE)=' | grep -q ibus || exit 0
7
48 mkdir -p ${XDG_DATA_HOME:-~/.local/share}
59 exec >> ${XDG_DATA_HOME:-~/.local/share}/ibus-mozc-gnome-initial-setup.log 2>&1
6 key=/org/gnome/desktop/input-sources/sources;
10
11 key=/org/gnome/desktop/input-sources/sources
12
13 # Try to read the current value
714 for i in $(seq 30); do
815 value=$(dconf read $key)
916 [ x != x"$value" ] && break; sleep 1
1017 done
18 [ x != x"$value" ] || { echo "E: dconf read failed"; exit 1; }
1119
12 [ x != x"$value" ] || { echo "E: dconf read failed"; exit 1; }
13 ( echo "$value" | \
14 grep -F "('ibus', " && { echo "I: GNOME ibus already set-up. Doing nothing. Current: $value"; exit 0; }; \
15 echo "I: Current: $value"; \
16 value="[('ibus', 'mozc-jp'), ${value#[}"; \
17 dconf write $key "$value" || { echo "E: dconf write failed. New: $value"; exit 1; }; \
18 echo "I: Done. New: $value" ) && touch ${XDG_CONFIG_HOME:-~/.config}/ibus-mozc-gnome-initial-setup-done
20 # Try to write the new value
21 (
22 # If some ibus input method is already used, keep hands off :-)
23 echo "$value" | grep -F "('ibus', " && { echo "I: GNOME ibus already set-up. Doing nothing. Current: $value"; exit 0; }
24
25 echo "I: Current: $value"
26
27 value="[('ibus', 'mozc-jp'), ${value#[}"
28 dconf write $key "$value" || { echo "E: dconf write failed. New: $value"; exit 1; }
29 echo "I: Done. New: $value"
30 ) && touch ${XDG_CONFIG_HOME:-~/.config}/ibus-mozc-gnome-initial-setup-done