blob: c9ad6c7b7043cd01ede6a4e51668577730873f0d [file] [log] [blame]
# Copyright (c) 2012 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 "Run the shill network connection manager"
author "chromium-os-dev@chromium.org"
start on (started boot-services and started wpasupplicant
and stopped iptables and stopped ip6tables)
stop on stopping boot-services
respawn
# Default log level and scopes for shill.
env SHILL_LOG_LEVEL=0
env SHILL_LOG_SCOPES=
pre-start script
rm -rf /var/run/shill
mkdir -p /var/run/shill
# Create storage for the shill global profile.
mkdir -p /var/cache/shill
# Use flimflam's default profile if shill doesn't have one.
if [ ! -f /var/cache/shill/default.profile -a \
-f /var/cache/flimflam/default.profile ]; then
mv /var/cache/flimflam/default.profile /var/cache/shill/default.profile
chmod a+r /var/cache/shill/default.profile
fi
# Set up dhcpcd's /var/{lib|run} dirs to run as user 'dhcp'.
mkdir -m 0755 -p /var/lib/dhcpcd
mkdir -m 0755 -p /var/run/dhcpcd
chmod -R u+rwX,g+rX,o+rX /var/lib/dhcpcd
chown -R dhcp:dhcp /var/lib/dhcpcd
chown -R dhcp:dhcp /var/run/dhcpcd
# This option is no longer supported.
rm -f /home/chronos/.disable_shill
end script
# HEADS UP! 'expect fork' is usually a loser when used with
# 'script'. Unfortunately, shill needs 'expect fork', and
# we need a script to figure out command arguments at run time.
#
# To avoid confusing Upstart, the script below can use only shell
# built-in operations until it gets to the 'exec' at the end. Any
# command that causes the shell to fork/exec a subprocess is a
# no-no.
expect fork
script
DAEMONBIN="shill"
# Hook for mod_for_test_scripts/100setupTestingInterface.
SHILL_TEST_ARGS=""
ARGS="--log-level=${SHILL_LOG_LEVEL} --log-scopes=${SHILL_LOG_SCOPES}"
ARGS="${ARGS} ${SHILL_TEST_ARGS}"
USER_PROFILE="~chronos/shill"
# if upstart respawns us, re-push the per-user profile as done by login.conf
if [ -f /var/run/state/logged-in ]; then
ARGS="${ARGS} --push=${USER_PROFILE}"
fi
# If OOBE has not completed (i.e. EULA not agreed to), do not run
# portal checks.
if [ ! -f /home/chronos/.oobe_completed ]; then
ARGS="${ARGS} --portal-list=''"
fi
exec ${DAEMONBIN} ${ARGS}
end script