Debian Codegraph @

scripts/sbin/drbl-kbdchooser

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4 # This program is used to replace the command "dpkg-reconfigure console-data" because console-data is in the process of being obsoleted by console-setup. For more info, check:
5 # http://bugs.debian.org/570223
6
7 #
8 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
9
10 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
11 [scip-shell system . . `[`. -e /etc/drbl/drbl-ocs.confscip-shell filesystem . . `/etc/drbl/drbl-ocs.conf`. ] && . /etc/drbl/drbl-ocs.confscip-shell source . . `/etc/drbl/drbl-ocs.conf`.
12 [scip-shell system . . `[`. -e $DRBL_SCRIPT_PATH/sbin/ocs-functions ] && . $DRBL_SCRIPT_PATH/sbin/ocs-functions
13
14 # Loading settings
15 [scip-shell system . . `[`. -e /etc/ocs/ocs-live.confscip-shell filesystem . . `/etc/ocs/ocs-live.conf`. ] && . /etc/ocs/ocs-live.confscip-shell source . . `/etc/ocs/ocs-live.conf`.
16
17 # Settings:
18 # Before we used "console_data", however, there are some issues sometimes:
19 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570223
20 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=893612
21 # 2018/03/21 we switch to "keyboard_configuration" which is actively developed.
22 preferred_configure="keyboard_configuration"
23
24 #
25 run_config_from_keyboard_configurationscip-shell shell shell-project 0.0.0 run_config_from_keyboard_configuration().() {
26 ask_and_load_lang_set
27 TMP="$(mktempscip-shell system . . mktemp. /tmp/keymap_mode.XXXXXXscip-shell filesystem . . `/tmp/keymap_mode.XXXXXX`.)"
28 ASK_KEYMAP=1
29 while [scip-shell system . . `[`. "$ASK_KEYMAP" -ne 0 ]; do
30 $DIA --nocancel --backtitle "$msg_nchc_free_software_labs" --title \
31 "$msg_keyboard_configuration" --menu "$msg_change_keyboard_layout?" \
32 0 0 0 \
33 Keep "$msg_keep_the_default_US_keymap" \
34 Change "$msg_change_keyboard_layout" \
35 2> $TMP
36 keymap_mode="$(catscip-shell system . . cat. $TMP)"
37 if [scip-shell system . . `[`. -z "$keymap_mode" ]; then
38 ASK_KEYMAP=1
39 else
40 ASK_KEYMAP=0
41 fi
42 done
43 [scip-shell system . . `[`. -f "$TMP" ] && rmscip-shell system . . rm. -f $TMP
44
45 #
46 if [scip-shell system . . `[`. "$keymap_mode" = "Change" ]; then
47 dpkg-reconfigurescip-shell system . . dpkg-reconfigure. keyboard-configuration
48 rc=$?
49 if [scip-shell system . . `[`. "$rc" -eq 0 ]; then
50 servicescip-shell system . . service. keyboard-setup restart
51 setupcon -k
52 # Read the settings. Its ccontents are like:
53 # XKBMODEL="pc105"
54 # XKBLAYOUT="us"
55 # XKBVARIANT=""
56 # XKBOPTIONS="ctrl:nocaps"
57 # BACKSPACE="bs"
58 . /etc/default/keyboardscip-shell source . . `/etc/default/keyboard`.
59 # Put the keyboard layout setting so that later program can reuse
60 if [scip-shell system . . `[`. -z "$(grepscip-shell system . . grep. -E "^[[:space:]]*live_keyboard_layouts=" /etc/ocs/ocs-live.confscip-shell filesystem . . `/etc/ocs/ocs-live.conf`. 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" ]; then
61 # Append it
62 echoscip-shell system . . echo. "live_keyboard_layouts=$XKBLAYOUT" >> /etc/ocs/ocs-live.confscip-shell filesystem . . `/etc/ocs/ocs-live.conf`.
63 else
64 # Modify it
65 perlscip-shell system . . perl. -pi -e "s|^[[:space:]]*live_keyboard_layouts=.*|live_keyboard_layouts=\"$XKBLAYOUT\"|g" /etc/ocs/ocs-live.confscip-shell filesystem . . `/etc/ocs/ocs-live.conf`.
66 fi
67 fi
68 fi
69 } # end of run_config_from_keyboard_configuration
70
71 #
72 run_config_from_console_datascip-shell shell shell-project 0.0.0 run_config_from_console_data().() {
73 dpkg-reconfigurescip-shell system . . dpkg-reconfigure. console-data
74 } # end of run_config_from_console_data
75
76 #
77 case $preferred_configure in
78 "console_data") run_config_from_console_datascip-shell shell shell-project 0.0.0 run_config_from_console_data(). ;;
79 "keyboard_configuration") run_config_from_keyboard_configurationscip-shell shell shell-project 0.0.0 run_config_from_keyboard_configuration(). ;;
80 esac