| # Copyright (c) 2013 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 "Set regulatory domain for restrictive domains" |
| author "chromium-os-dev@chromium.org" |
| |
| # We also need to run after cfg80211 is loaded by network-services.conf so |
| # the "iw" command will work. |
| start on started network-services |
| |
| # The list of regulatory domains which we must apply in order to constrain |
| # the system to a more restrictive behavior than our world regulatory domain. |
| # The system can only be set to one regulatory domain at a time. As well, |
| # any given system should have only one "region" value. However, in order |
| # to hedge against any strange cases, this value should be in decreasing |
| # order of constraints, so the system will attain the most constrained |
| # domain. |
| script |
| region="$(vpd_get_value region | tr '[:lower:]' '[:upper:]')" |
| regdomain="${region%%.*}" |
| |
| case "${regdomain}" in |
| ID|AR|US|RU) |
| # Wait for a wireless LAN interface to appear, since this regdomain |
| # needs to be applied afterwards. |
| wait_tries=0 |
| while [ ${wait_tries} -le 10 ] ; do |
| if iw dev | grep -q Interface; then |
| break |
| fi |
| sleep 1 |
| wait_tries=$((wait_tries + 1)) |
| done |
| iw reg set "${regdomain}" |
| break |
| ;; |
| esac |
| end script |