Преглед на файлове

Add Timezone and Lang Configuration for Web

Add functionality in the installer to enable timezone and language
configuration.
pull/120/head
Justin Karimi преди 3 години
родител
ревизия
6a9857fc70
променени са 1 файла, в които са добавени 31 реда и са изтрити 0 реда
  1. +31
    -0
      install.sh

+ 31
- 0
install.sh Целия файл

@@ -24,6 +24,10 @@ log_running() {
echo " ${YELLOW}*${RESET} $1"
}

log_error() {
echo " ${RED}error: $1${RESET}"
}

success() {
echo "${GREEN}$1${RESET}"
}
@@ -250,6 +254,33 @@ else
sed -i -e "s/enable_bias_tee//g" "$HOME/.noaa.conf"
fi

echo "
Next we'll configure your webpanel language
and locale settings - you can update these in the
future by modifying 'lang' in /var/www/wx/Config.php
and 'date_default_timezone_set' in /var/www/wx/header.php
"

# language configuration
langs=($(find templates/webpanel/language/ -type f -printf "%f\n" | cut -f 1 -d '.'))
while : ; do
read -rp "Enter your preferred language (${langs[*]}): "
lang=$REPLY

if [[ ! " ${langs[@]} " =~ " ${lang} " ]]; then
log_error "choice $lang is not one of the available options (${langs[*]})"
else
break
fi
done
sed -i -e "s/'lang' => '.*'$/'lang' => '${lang}'/" "/var/www/wx/Config.php"

echo "Visit https://www.php.net/manual/en/timezones.php for a list of available timezones"
read -rp "Enter your preferred timezone: "
timezone=$REPLY
timezone=$(echo $timezone | sed 's/\//\\\//g')
sed -i -e "s/date_default_timezone_set('.*');/date_default_timezone_set('${timezone}');/" "/var/www/wx/header.php"

echo "
It's time to configure your ground station
You'll be asked for your latitude and longitude


Зареждане…
Отказ
Запис