# Copyright (c) 2011 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     "Initialize crash reporting services"
author          "chromium-os-dev@chromium.org"

# This job merely initializes its service and then terminates; the
# actual checking and reporting of crash dumps is triggered by an
# hourly cron job.
start on starting system-services

pre-start script
  mkdir -p /var/spool

  # Only allow device coredumps on a "developer system".
  if ! is_developer_end_user; then
    # consumer end-user - disable device coredumps, if driver exists.
    echo 1 > /sys/class/devcoredump/disabled || true
  fi
end script

# crash_reporter uses argv[0] as part of the command line for
# /proc/sys/kernel/core_pattern.  That command line is invoked by
# the kernel, and can't rely on PATH, so argv[0] must be a full
# path; we invoke it as such here.
exec /sbin/crash_reporter --init
