From 7e6922e89d3dd1fc6ec2fd8b43491539866018a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Aime?= Date: Mon, 8 Feb 2021 17:40:30 +0100 Subject: [PATCH] Update install script with locales --- install.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/install.sh b/install.sh index 474fdb0..8b32880 100644 --- a/install.sh +++ b/install.sh @@ -6,6 +6,7 @@ HOST="$( hostname )" IFACES="$( ifconfig -a | grep -Eo '[a-z0-9]{4,14}\: ' | grep -oE [a-z0-9]+ )" IFACE_OUT="" IFACE_IN="" +LOCALES=(en fr) welcome_screen() { cat << "EOF" @@ -40,6 +41,22 @@ check_operating_system() { fi } +set_userlang() { + # Set the user language. + echo -e "\e[39m[+] Setting the user language...\e[39m" + printf -v joined '%s/' "${LOCALES[@]}" + echo -n " Please choose a language for the reports and the interface (${joined%/}): " + read lang + + if [[ " ${LOCALES[@]} " =~ " ${lang} " ]]; then + sed -i "s/userlang/${$lang}/g" /usr/share/tinycheck/config.yaml + echo -e "\e[92m [✔] User language setted!\e[39m" + else + echo -e "\e[91m [✘] You must choose between the languages proposed, let's retry.\e[39m" + set_userlang + fi +} + set_credentials() { # Set the credentials to access to the backend. echo -e "\e[39m[+] Setting the backend credentials...\e[39m" @@ -410,6 +427,7 @@ else check_operating_system check_interfaces create_directory + set_userlang set_credentials check_dependencies configure_dnsmask