mirror of
git://code.qt.io/qt/qt5.git
synced 2026-05-09 20:47:49 +08:00
Provisioning: Add retry for disabling Spotlight indexing
Task-number: QTQAINFRA-5996 Pick-to: 6.8 Change-Id: I6c85816f7b490fbb2423cbf7d0efe862056bc001 Reviewed-by: Toni Saario <toni.saario@qt.io>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# Copyright (C) 2017 The Qt Company Ltd.
|
# Copyright (C) 2017 The Qt Company Ltd.
|
||||||
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
disableSpotlight() {
|
||||||
# Disable spotlight and and stop indexing
|
# Disable spotlight and and stop indexing
|
||||||
sudo mdutil -a -i off
|
sudo mdutil -a -i off
|
||||||
sudo mdutil -a -i off /
|
sudo mdutil -a -i off /
|
||||||
@@ -9,3 +10,21 @@ sudo mdutil -a -i off /
|
|||||||
sudo mdutil -i off /Volumes
|
sudo mdutil -i off /Volumes
|
||||||
# Erase spotlight index
|
# Erase spotlight index
|
||||||
sudo mdutil -E /
|
sudo mdutil -E /
|
||||||
|
}
|
||||||
|
|
||||||
|
# Disabling spotlight tends to be flaky, add some retry
|
||||||
|
for i in $(seq 1 5)
|
||||||
|
do
|
||||||
|
disableSpotlight
|
||||||
|
res=$?
|
||||||
|
if [[ $res -eq 0 ]]
|
||||||
|
then
|
||||||
|
echo "Spotlight disabled"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Failed to disable spotlight, $i retry..."
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $res
|
||||||
|
|||||||
Reference in New Issue
Block a user