Skip to content

Commit

Permalink
First login keyboard configuration bugfix (armbian#2746)
Browse files Browse the repository at this point in the history
* 1st login keyboard configuration bugfix

- added small bugfix which caused to select locales too broad
- switch "automated" keyboard detection for selection prompt

* Remove dpkg-reconfigure keyboard-configuration

* Remve unused variable
  • Loading branch information
igorpecovnik authored and root committed Feb 4, 2022
1 parent e2ad9a7 commit c0198a1
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/bsp/common/usr/lib/armbian/armbian-firstlogin
Expand Up @@ -95,11 +95,10 @@ set_timezone_and_locales()
TZDATA=$(echo ${RES} | cut -d"," -f1)
STATE=$(echo ${RES} | cut -d"," -f2)
CCODE=$(echo ${RES} | cut -d"," -f3 | xargs)
KEYBOARD="${CCODE,,}"
LOCALES=$(grep territory /usr/share/i18n/locales/* | grep "$CCODE" | cut -d ":" -f 1 | cut -d "/" -f 6 | \
LOCALES=$(grep territory /usr/share/i18n/locales/* | grep _"$CCODE" | cut -d ":" -f 1 | cut -d "/" -f 6 | \
xargs -I{} grep {} /usr/share/i18n/SUPPORTED | grep "\.UTF-8" | cut -d " " -f 1)
# UTF8 is not present everywhere so check again in case it returns empty value
[[ -z "$LOCALES" ]] && LOCALES=$(grep territory /usr/share/i18n/locales/* | grep "$CCODE" | cut -d ":" -f 1 | cut -d "/" -f 6 | \
[[ -z "$LOCALES" ]] && LOCALES=$(grep territory /usr/share/i18n/locales/* | grep _"$CCODE" | cut -d ":" -f 1 | cut -d "/" -f 6 | \
xargs -I{} grep {} /usr/share/i18n/SUPPORTED | cut -d " " -f 1)
echo -e "Detected timezone: \x1B[92m$TZDATA\x1B[0m"
echo ""
Expand Down Expand Up @@ -146,14 +145,6 @@ set_timezone_and_locales()
echo "export LANG=$LOCALES" >> /home/$RealUserName/.xsessionrc
echo "export LANGUAGE=$LOCALES" >> /home/$RealUserName/.xsessionrc

# adding another keyboard layout
if grep -q " ${CCODE,,} " /usr/share/X11/xkb/rules/base.lst ; then
echo -e "Adding console keyboard layout: \x1B[92m$CCODE\x1B[0m"
CCODE=$(cat /etc/default/keyboard | grep XKBLAYOUT | awk -F'"' '$0=$2')",$CCODE"
sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"$KEYBOARD\"/" /etc/default/keyboard
setupcon -k --force
fi

fi
fi
fi
Expand Down

0 comments on commit c0198a1

Please sign in to comment.