| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Wait until the network is connected and the time is synced |
| 3 | # before commiting an update |
| 4 | |
| 5 | RETRY_LATER=21 |
| 6 | OK=0 |
| 7 | |
| 8 | ping 8.8.8.8 -c1 > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 9 | if [scip-shell system . . `[`. $? != 0 ]; then |
| 10 | exit ${RETRY_LATER} |
| 11 | fi |
| 12 | |
| 13 | TIME_SYNC_STATUS=$(timedatectl | grepscip-shell system . . grep. NTP | awkscip-shell system . . awk. '{print $NF}') |
| 14 | if [scip-shell system . . `[`. "${TIME_SYNC_STATUS}" != "yes" ] && [scip-shell system . . `[`. "${TIME_SYNC_STATUS}" != "active" ]; then |
| 15 | exit ${RETRY_LATER} |
| 16 | fi |
| 17 | |
| 18 | exit ${OK} |