From 3040bc41277ac02950c5296d7275c172d0e24aa7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Thu, 11 Nov 2021 16:54:25 -0500 Subject: [PATCH] updated welcome_wizard --- scripts/welcome_wizard.sh | 42 +++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/scripts/welcome_wizard.sh b/scripts/welcome_wizard.sh index 75e4969..a53a36d 100755 --- a/scripts/welcome_wizard.sh +++ b/scripts/welcome_wizard.sh @@ -19,11 +19,13 @@ overview() { 2) Setting your Language, Country, Timezone, Keyboard, and WiFi Country (if applicable) -3) Connect to WiFi (if applicable) +3) Connect to WiFi (if applicable) / Set Date and Time (if applicable) -4) Changing the birdnet.conf configuration file to your needs +4) Set BirdNET-Pi's latitude and longitude -5) Updating the system to use your new birdnet.conf file" --no-wrap --icon-name=red-cardinal +5) Set the web interface and database passwords + +6) Updating the system to use your new birdnet.conf file" --no-wrap --icon-name=red-cardinal if [ $? -eq 0 ];then exit 1 @@ -59,12 +61,43 @@ change_locale() { 4) WiFi Country: Choose your country from the list" --no-wrap --icon-name=red-cardinal if [ $? -eq 1 ];then - get_latitude + sync_clock else change_password fi } +sync_clock() { + zenity --title="Connecting to WiFi/Setting the Date and Time" --window-icon=/usr/share/pixmaps/red-cardinal32.png \ + --question --ok-label="Automatically" --cancel-label="Manually" --icon-name=red-cardinal --text="Should the installation update the date and time Automatically (using the internet), +or will you do this Manually?" --no-wrap + if [ $? -eq 1 ];then + get_date_and_time + else + setup_wifi + fi +} + +get_date_and_time() { + full_date="$(zenity --forms --title="Set the current time" --window-icon=/usr/share/pixmaps/red-cardinal32.png --add-calendar=Calendar --add-combo="Current Hour (24h)" --combo-values="01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23" --add-combo="Current Minute" --combo-values="00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59" --add-combo="Current Second" --combo-values="00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59")" + current_date="$(echo ${full_date} | awk -F\| '{print $1}')" + if ! [ -z $current_date ];then + current_time="$(echo ${full_date} | awk -F\| '{print $1" "$2":"$3":"$4}')" + sudo date -s "${current_time}" + get_latitude + else + sync_clock + fi +} + +setup_wifi() { + zenity --title="Connect to WiFi" --window-icon=/usr/share/pixmaps/red-cardinal32.png --info --text="Use the Networking Icon in the top right corner of +the screen to select your WiFi network. Enter the credentials to connect when prompted. + +Press \"Continue\" after you have connected." --ok-label="Continue" --no-wrap + get_latitude +} + open_rpi_configuration() { if ! pgrep rc_gui;then env SUDO_ASKPASS=/usr/lib/rc-gui/pwdrcg.sh sudo -AE rc_gui & @@ -118,3 +151,4 @@ set_db_pwd() { overview +exit