Provisioning: Reset Time Zone for macOS 10.14

Setting Time Zone for macOS 10.14 seems to be flaky. Let's reset it. If
it still fails to set it then exit the script execution.

Task-number: QTBUG-92174
Change-Id: I07b28d0511d8fc097a1da43b78de9a5131f6bfa7
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit ba149a162b)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit c84925c512)
This commit is contained in:
Heikki Halmet
2021-03-30 09:54:45 +03:00
parent 47eb374631
commit 4578721c38
2 changed files with 26 additions and 2 deletions

View File

@@ -2,7 +2,7 @@
#############################################################################
##
## Copyright (C) 2019 The Qt Company Ltd.
## Copyright (C) 2021 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the provisioning scripts of the Qt Toolkit.
@@ -97,4 +97,16 @@ echo "Set Network Test Server address to $NTS_IP in /etc/hosts"
echo "$NTS_IP qt-test-server qt-test-server.qt-test-net" | sudo tee -a /etc/hosts
sudo systemsetup settimezone GMT
# Setting Time Zone seems to be flaky in macOS 10.13 and in macOS 10.14. Checking that Time Zone is correct. If not, reset it.
if [[ $(sudo systemsetup -gettimezone) = *GMT* ]]; then
echo "Time Zone is GMT"
else
echo "Wrong Time Zone. Reset Time Zone to GMT"
sleep 5
sudo systemsetup settimezone GMT
if [[ $(sudo systemsetup -gettimezone) != *GMT* ]]; then
echo "Couldn't set Time Zone!"
exit 1
fi
fi
sudo rm -f "$targetFile"

View File

@@ -2,7 +2,7 @@
#############################################################################
##
## Copyright (C) 2019 The Qt Company Ltd.
## Copyright (C) 2021 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing/
##
## This file is part of the provisioning scripts of the Qt Toolkit.
@@ -97,5 +97,17 @@ echo "Set Network Test Server address to $NTS_IP in /etc/hosts"
echo "$NTS_IP qt-test-server qt-test-server.qt-test-net" | sudo tee -a /etc/hosts
sudo systemsetup settimezone GMT
# Setting Time Zone seems to be flaky in macOS 10.13 and in macOS 10.14. Checking that Time Zone is correct. If not, reset it.
if [[ $(sudo systemsetup -gettimezone) = *GMT* ]]; then
echo "Time Zone is GMT"
else
echo "Wrong Time Zone. Reset Time Zone to GMT"
sleep 5
sudo systemsetup settimezone GMT
if [[ $(sudo systemsetup -gettimezone) != *GMT* ]]; then
echo "Couldn't set Time Zone!"
exit 1
fi
fi
sudo systemsetup setusingnetworktime off
sudo rm -f "$targetFile"