blob: 38d0651cdb4dc640d1f1909c475d6f78f57434ae [file] [log] [blame]
# Copyright (c) 2010 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.
# cromo
# starts cromo if a GOBI modem has been detected
start on gobi_modem
# enable cromo
# uid and gid hardcoded in sys-apps/baselayout
pre-start script
mkdir -p /var/run/cromo
chown cromo:cromo /var/run/cromo
end script
exec /sbin/minijail --uid=210 --gid=210 /usr/sbin/cromo
# post-stop cleans up (resets) any gobi devices that are listed in the
# usb-devices file. On normal shutdown, gobi-cromo-plugin will empty
# the file and nothing will be reset. On abnormal termination, the
# file will contain a list of devices which require a reset.
post-stop script
for dev in $(cat /var/run/cromo/usb-devices); do
if ! echo "$dev" | grep -q "$VALID" ; then
logger -t "upstart-cromo" "Skipping invalid device $dev"
logger -t "upstart-cromo" "rebooting: $dev"
echo 0 > /sys/bus/usb/devices/$dev/authorized
echo 1 > /sys/bus/usb/devices/$dev/authorized
end script