Provisioning: Allow retry when disabling spotlight indexing

Task-number: QTQAINFRA-5996
Change-Id: I05ef6d33d74448ee830d137b137c6ee73f6e0518
Reviewed-by: Ville-Pekka Karhu <ville-pekka.karhu@qt.io>
This commit is contained in:
Simo Fält
2025-02-18 11:00:08 +02:00
parent dc25215462
commit fda391a753

View File

@@ -2,14 +2,17 @@
# 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
# Allow retry in case mdutil fails with first tries
set +e
disableSpotlight() {
# Disable spotlight and and stop indexing
sudo mdutil -a -i off
sudo mdutil -a -i off /
sudo mdutil -a -i off || return 1
sudo mdutil -a -i off / || return 1
# Disable spotlight indexing /Volumes
sudo mdutil -i off /Volumes
sudo mdutil -i off /Volumes || return 1
# Erase spotlight index
sudo mdutil -E /
sudo mdutil -E / || return 1
}
# Disabling spotlight tends to be flaky, add some retry