1# 2# Copyright (C) 2014 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17description "Run the access point manager daemon" 18author "chromium-os-dev@chromium.org" 19 20start on stopped iptables and stopped ip6tables and started shill 21stop on stopping system-services 22 23env APMANAGER_LOG_LEVEL=0 24 25pre-start script 26 # Load the module that provides the WiFi configuration API, since 27 # apmanager will abort if that API is not available. In most cases, 28 # cfg80211 will be loaded implicitly when the device driver is 29 # loaded (in preload-network). However, this deals with the 30 # first-boot case, in case apmanager starts before the device driver is 31 # loaded. 32 modprobe cfg80211 || 33 logger -p err -t "$UPSTART_JOB" "Failed to load cfg80211" 34 35 # Create directory for storing config files. 36 mkdir -m 0755 -p /var/run/apmanager/hostapd 37 mkdir -m 0755 -p /var/run/apmanager/dnsmasq 38 chown -R apmanager:apmanager /var/run/apmanager/hostapd 39 chown -R apmanager:apmanager /var/run/apmanager/dnsmasq 40end script 41 42exec /usr/bin/apmanager --v="${APMANAGER_LOG_LEVEL}" 43