From 83e19f4f54201e1f0bef9e2bf4e703b1103650cb Mon Sep 17 00:00:00 2001 From: Simon Long Date: Fri, 27 Jan 2017 15:29:05 +0000 Subject: [PATCH] Prevent setting keyboard language when logged in via SSH. --- raspi-config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/raspi-config b/raspi-config index 80bdb13..3de9c64 100755 --- a/raspi-config +++ b/raspi-config @@ -54,6 +54,14 @@ is_live() { return $? } +is_ssh() { + if pstree -p | egrep --quiet --extended-regexp ".*sshd.*\($$\)"; then + return 0 + else + return 1 + fi +} + get_init_sys() { if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then SYSTEMD=1 @@ -1493,12 +1501,20 @@ if [ -n "${OPT_MEMORY_SPLIT:-}" ]; then fi do_internationalisation_menu() { + if is_ssh ; then + FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ + "I1 Change Locale" "Set up language and regional settings to match your location" \ + "I2 Change Timezone" "Set up timezone to match your location" \ + "I4 Change Wi-fi Country" "Set the legal channels used in your country" \ + 3>&1 1>&2 2>&3) + else FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ "I1 Change Locale" "Set up language and regional settings to match your location" \ "I2 Change Timezone" "Set up timezone to match your location" \ "I3 Change Keyboard Layout" "Set the keyboard layout to match your keyboard" \ "I4 Change Wi-fi Country" "Set the legal channels used in your country" \ 3>&1 1>&2 2>&3) + fi RET=$? if [ $RET -eq 1 ]; then return 0