change keyboard settings earlier in the script (#881)

This commit is contained in:
Daniel Hansson 2019-07-16 13:07:22 +02:00 committed by GitHub
parent f860c3ce45
commit a2f4edbbfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 25 deletions

1
lib.sh
View File

@ -18,6 +18,7 @@ NC_APPS_PATH=$NCPATH/apps
# Ubuntu OS
DISTRO=$(lsb_release -sd | cut -d ' ' -f 2)
KEYBOARD_LAYOUT=$(localectl status | grep "Layout" | awk '{print $3}')
# Network
[ ! -z "$FIRST_IFACE" ] && IFACE=$(lshw -c network | grep "logical name" | awk '{print $3; exit}')
IFACE2=$(ip -o link show | awk '{print $2,$9}' | grep 'UP' | cut -d ':' -f 1)

View File

@ -214,6 +214,22 @@ then
exit 1
fi
# Set keyboard layout
if [ "$KEYBOARD_LAYOUT" != "se" ]
then
print_text_in_color "$ICyan" "Current keyboard layout is $KEYBOARD_LAYOUT"
if [[ "no" == $(ask_yes_or_no "Do you want to change keyboard layout?") ]]
then
print_text_in_color "$ICyan" "Not changing keyboard layout..."
sleep 1
clear
else
dpkg-reconfigure keyboard-configuration
msg_box "The server will now be rebooted to apply the new keyboard settings. Please run this script again once rebooted."
reboot
fi
fi
# Is this run as a pure root user?
if is_root
then
@ -311,18 +327,6 @@ It will also do the following:
###################### T&M Hansson IT - $(date +"%Y") ######################"
clear
# Set keyboard layout
print_text_in_color "$ICyan" "Current keyboard layout is $(localectl status | grep "Layout" | awk '{print $3}')"
if [[ "no" == $(ask_yes_or_no "Do you want to change keyboard layout?") ]]
then
print_text_in_color "$ICyan" "Not changing keyboard layout..."
sleep 1
clear
else
dpkg-reconfigure keyboard-configuration
clear
fi
# Change Timezone
print_text_in_color "$ICyan" "Current timezone is $(cat /etc/timezone)"
if [[ "no" == $(ask_yes_or_no "Do you want to change the timezone?") ]]

View File

@ -57,9 +57,34 @@ debug_mode
# Check if root
root_check
# Set keyboard layout
if [ "$KEYBOARD_LAYOUT" != "se" ]
then
print_text_in_color "$ICyan" "Current keyboard layout is $KEYBOARD_LAYOUT"
if [[ "no" == $(ask_yes_or_no "Do you want to change keyboard layout?") ]]
then
print_text_in_color "$ICyan" "Not changing keyboard layout..."
sleep 1
clear
else
dpkg-reconfigure keyboard-configuration
msg_box "The server will now be rebooted to apply the new keyboard settings. Please run this script again once rebooted."
reboot
fi
fi
# Set locales
KEYBOARD_LAYOUT=$(localectl status | grep "Layout" | awk '{print $3}')
install_if_not language-pack-en-base
sudo locale-gen "sv_SE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
if [ "$KEYBOARD_LAYOUT" = "se" ]
then
sudo locale-gen "sv_SE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
elif [ "$KEYBOARD_LAYOUT" = "de" ]
then
sudo locale-gen "de_DE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
else
sudo locale-gen "en_US.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
fi
# Test RAM size (2GB min) + CPUs (min 1)
ram_check 2 Nextcloud
@ -179,18 +204,6 @@ else
fi
clear
# Set keyboard layout
print_text_in_color "$ICyan" "Current keyboard layout is $(localectl status | grep "Layout" | awk '{print $3}')"
if [[ "no" == $(ask_yes_or_no "Do you want to change keyboard layout?") ]]
then
print_text_in_color "$ICyan" "Not changing keyboard layout..."
sleep 1
clear
else
dpkg-reconfigure keyboard-configuration
clear
fi
# Install PostgreSQL
# sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main"
# curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -