summaryrefslogtreecommitdiff
path: root/init/shill.conf.in
blob: 553219c1701acbccdadcd1c16d7583755c9afa35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# Copyright (C) 2012 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

description   "Run the shill network connection manager"
author        "chromium-os-dev@chromium.org"

# shill termination may take more than 5s (the default kill timeout) in some
# cases (e.g. it needs to disconnect a cellular modem from the network). A
# longer kill timeout is used to ensure that shill terminates properly in most
# cases. Also, stop shill on "starting pre-shutdown" so its exiting blocks the
# chromeos_shutdown script from running (jobs that "stop on stopping
# boot-services" may still be running in parallel with chromeos_shutdown if
# they do not exit quickly).
start on @expected_started_services@
stop on starting pre-shutdown
kill timeout 10
respawn

# Default parameters to be overridden by upstart configuration.
env SHILL_LOG_LEVEL=0
env SHILL_LOG_SCOPES=
env SHILL_PASSIVE_MODE=
env SHILL_PREPEND_DNS_SERVERS=
env SHILL_ACCEPT_HOSTNAME_FROM=
env SHILL_MINIMUM_MTU=
env BLACKLISTED_DEVICES=
env DHCPV6_ENABLED_DEVICES=

# Hook for mod_for_test_scripts/100setupTestingInterface.
env SHILL_TEST_DEVICES=""

pre-start script
  bootstat shill-start

  # Create state directory
  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

post-stop script
  bootstat shill-stop
end script

script
  DAEMONBIN="shill"
  ARGS="--log-level=${SHILL_LOG_LEVEL} --log-scopes=${SHILL_LOG_SCOPES}"
  if [ -n "${BLACKLISTED_DEVICES}" ] && [ -n "${SHILL_TEST_DEVICES}" ]; then
    ARGS="${ARGS} --device-black-list=${BLACKLISTED_DEVICES},${SHILL_TEST_DEVICES}"
  elif [ -n "${BLACKLISTED_DEVICES}" ]; then
    ARGS="${ARGS} --device-black-list=${BLACKLISTED_DEVICES}"
  elif [ -n "${SHILL_TEST_DEVICES}" ]; then
    ARGS="${ARGS} --device-black-list=${SHILL_TEST_DEVICES}"
  fi
  if [ -n "${SHILL_PASSIVE_MODE}" ]; then
    ARGS="${ARGS} --passive-mode"
  fi
  if [ -n "${SHILL_PREPEND_DNS_SERVERS}" ]; then
    ARGS="${ARGS} --prepend-dns-servers=${SHILL_PREPEND_DNS_SERVERS}"
  fi
  if [ -n "${SHILL_ACCEPT_HOSTNAME_FROM}" ]; then
    ARGS="${ARGS} --accept-hostname-from=${SHILL_ACCEPT_HOSTNAME_FROM}"
  fi
  if [ -n "${SHILL_MINIMUM_MTU}" ]; then
    ARGS="${ARGS} --minimum-mtu=${SHILL_MINIMUM_MTU}"
  fi
  if [ -n "${DHCPV6_ENABLED_DEVICES}" ]; then
    ARGS="${ARGS} --dhcpv6-enabled-devices=${DHCPV6_ENABLED_DEVICES}"
  fi
  ARGS="${ARGS} ${SHILL_TEST_ARGS}"

  # 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