From 1e32dac8dace5f3dbccfc80528f3a08164f3802b Mon Sep 17 00:00:00 2001 From: stormdragon2976 Date: Thu, 19 Jan 2023 01:00:33 -0500 Subject: [PATCH] The configure-stormux stub should now set the clock before updating so that there will not be certificate is not yet valid errors. --- pi3/files/usr/local/bin/configure-stormux | 14 +++++++++++++- pi4/files/usr/local/bin/configure-stormux | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pi3/files/usr/local/bin/configure-stormux b/pi3/files/usr/local/bin/configure-stormux index c451c0b..e5b3675 100755 --- a/pi3/files/usr/local/bin/configure-stormux +++ b/pi3/files/usr/local/bin/configure-stormux @@ -23,8 +23,20 @@ if [[ ! -d /opt/configure-stormux ]]; then read -r continue nmtui-connect fi +# Check for internet connectivity +if ping -qc1 -W 1 gnu.org &> /dev/null; then + echo "Updating the clock to prevent certificate errors..." + # Get current date and time + date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*') + echo "Current date and time: $date_time" + # set date and time + sudo date -s "$date_time" +else + echo "Please connect to the internet and run ${0##*/} again." + exit 1 +fi echo "Installing configure-stormux..." - sudo git -C /opt clone -q https://gitlab.com/stormux/configure-stormux.git || exit 1 + sudo git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1 fi pushd /opt/configure-stormux diff --git a/pi4/files/usr/local/bin/configure-stormux b/pi4/files/usr/local/bin/configure-stormux index 0e58f67..e5b3675 100755 --- a/pi4/files/usr/local/bin/configure-stormux +++ b/pi4/files/usr/local/bin/configure-stormux @@ -23,6 +23,18 @@ if [[ ! -d /opt/configure-stormux ]]; then read -r continue nmtui-connect fi +# Check for internet connectivity +if ping -qc1 -W 1 gnu.org &> /dev/null; then + echo "Updating the clock to prevent certificate errors..." + # Get current date and time + date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*') + echo "Current date and time: $date_time" + # set date and time + sudo date -s "$date_time" +else + echo "Please connect to the internet and run ${0##*/} again." + exit 1 +fi echo "Installing configure-stormux..." sudo git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1 fi