theypsilon / Update_All_MiSTer

All-in-one script for updating your MiSTer
GNU General Public License v3.0
605 stars 27 forks source link

Check system clock is set correctly before updating #79

Closed symm closed 2 years ago

symm commented 2 years ago

Issue

If the system time has not been set then update_all.sh is unable to do it's thing

This can happen when the MiSTer has a network connection but was unable to set the time via ntpd.

Proposed change

Check the system time and bail early with a message if the clock appears to be invalid.

Steps to reproduce:

Set the system clock back to the epoch date -d '@0'

Try to run the updater: /media/fat/Scripts/update_all.sh

Script fails but it's not immediately obvious what has gone wrong:

Downloading
https://github.com/theypsilon/Update_All_MiSTer

Executing 'Update All' script
The All-in-One Updater for MiSTer
Version 1.4

Reading INI file './update_all.ini':
OK.

Sequence:
- Main Distribution: MiSTer-devel
- JTCORES for MiSTer (jtpremium)
- Arcade Offset folder
- BIOS Getter
- MAME Getter
- HBMAME Getter
- Arcade Organizer

Starting in 12 seconds....
 *Press <UP>, To enter the SETTINGS screen.
 *Press <DOWN>, To continu

Start time: Thu 01 Jan 1970 01:52:43 AM BST

################################################################################
#==============================================================================#
################################################################################

Running MiSTer Downloader

START!

Reading file: /media/fat/downloader.ini
Reading 'distribution_mister' db section
Reading 'jtcores' db section
Reading 'arcade_offset_folder' db section
Could not download file from db_url: "https://raw.githubusercontent.com/MiSTer-devel/Distribution_MiSTer/main/db.json.zip"
Could not download file from db_url: "https://raw.githubusercontent.com/jotego/jtpremium/main/jtbindb.json.zip"
Could not download file from db_url: "https://raw.githubusercontent.com/atrac17/Arcade_Offset/db/arcadeoffsetdb.json.zip"
theypsilon commented 2 years ago

Thank you so much for the commit. That message will be very helpful for the user.