blob: 76a29b90183b8f6f696f02b22dc8e5f6f3188ee0 [file] [log] [blame]
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Report the powerwash count if one happened"
author "chromium-os-dev@chromium.org"
start on started system-services
script
POWERWASH_COMPLETE="/mnt/stateful_partition/unencrypted/.powerwash_completed"
POWERWASH_COUNT="/mnt/stateful_partition/unencrypted/preserve/powerwash_count"
# Report powerwash stats if a powerwash recently occurred.
if [ -f $POWERWASH_COMPLETE -a -f /home/chronos/.oobe_completed ]; then
# Upload the fact powerwash occurred and the number of times this device
# has been powerwashed.
COUNT=$(head -1 $POWERWASH_COUNT | cut -c1-4)
if [ $(expr "$COUNT" : "^[0-9][0-9]*$") -ne 0 ]; then
metrics_client Installer.PowerwashCount $COUNT 1 1000 20
fi
rm -f $POWERWASH_COMPLETE
fi
end script