#!/bin/bash LANGUAGE_VALENCIAN="ca_ES@valencia:ca:qcv:es_ES:es:en" LANGUAGE_CASTILIAN="es_ES:es:en" LANGUAGE_ENGLISH="en_US:en" ENVIRONMENT_FILE="/etc/environment" DEFAULT_LOCALE_FILE="/etc/default/locale" rc=0 cat $ENVIRONMENT_FILE| grep -q ^LANGUAGE || rc=1 if [ $rc -eq 1 ]; then echo "Info: Not language setted" logger -t "lliurex-language-fixer" "Not language setted..." current_locale="$(cat $DEFAULT_LOCALE_FILE| head -1 |cut -d "=" -f2)" echo "$current_locale" if [ "$current_locale" = "\"ca_ES.UTF-8@valencia\"" ]; then echo "LANGUAGE=$LANGUAGE_VALENCIAN" >> $ENVIRONMENT_FILE logger -t "lliurex-language-fixer" "LANGUAGE=$LANGUAGE_VALENCIAN >> $ENVIRONMENT_FILE" elif [ "$current_locale" = "\"es_ES.UTF-8\"" ]; then echo "LANGUAGE=$LANGUAGE_CASTILIAN" >> $ENVIRONMENT_FILE logger -t "lliurex-language-fixer" "LANGUAGE=$LANGUAGE_CASTILIAN >> $ENVIRONMENT_FILE" else echo "LANGUAGE=$LANGUAGE_VALENCIAN" >> $ENVIRONMENT_FILE logger -t "lliurex-language-fixer" "NOT FOUND..default: LANGUAGE=$LANGUAGE_VALENCIAN >> $ENVIRONMENT_FILE" fi fi rc=0 cat $ENVIRONMENT_FILE| grep -q ^LANGUAGE=\"ca_ES:ca\" || rc=1 if [ $rc -eq 0 ]; then current_locale="$(cat $DEFAULT_LOCALE_FILE| head -1 |cut -d "=" -f2)" echo "$current_locale" if [ "$current_locale" = "\"ca_ES.UTF-8@valencia\"" ]; then echo "LANGUAGE=$LANGUAGE_VALENCIAN" >> $ENVIRONMENT_FILE logger -t "lliurex-language-fixer" "LANGUAGE=$LANGUAGE_VALENCIAN >> $ENVIRONMENT_FILE" fi fi exit 0