diff --git a/lib.sh b/lib.sh index d4c5622d..b7090a66 100644 --- a/lib.sh +++ b/lib.sh @@ -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) diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index e888a07b..6c3685dc 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -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?") ]] diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 8b8e209b..2823807f 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -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 -