Update install script with locales

This commit is contained in:
Félix Aime 2021-02-08 17:40:30 +01:00
parent 1cd025b2ea
commit 7e6922e89d

View File

@ -6,6 +6,7 @@ HOST="$( hostname )"
IFACES="$( ifconfig -a | grep -Eo '[a-z0-9]{4,14}\: ' | grep -oE [a-z0-9]+ )" IFACES="$( ifconfig -a | grep -Eo '[a-z0-9]{4,14}\: ' | grep -oE [a-z0-9]+ )"
IFACE_OUT="" IFACE_OUT=""
IFACE_IN="" IFACE_IN=""
LOCALES=(en fr)
welcome_screen() { welcome_screen() {
cat << "EOF" cat << "EOF"
@ -40,6 +41,22 @@ check_operating_system() {
fi 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_credentials() {
# Set the credentials to access to the backend. # Set the credentials to access to the backend.
echo -e "\e[39m[+] Setting the backend credentials...\e[39m" echo -e "\e[39m[+] Setting the backend credentials...\e[39m"
@ -410,6 +427,7 @@ else
check_operating_system check_operating_system
check_interfaces check_interfaces
create_directory create_directory
set_userlang
set_credentials set_credentials
check_dependencies check_dependencies
configure_dnsmask configure_dnsmask