#!/bin/sh /etc/rc.common START=09 copy_certificates() { [ -f /certificates/key.pem ] || return cp /certificates/cert.pem /certificates/key.pem /certificates/operational.* /etc/ucentral/ chown root.network /etc/ucentral/*.pem /etc/ucentral/*.ca chmod 0440 root.network /etc/ucentral/*.pem /etc/ucentral/*.ca [ -f /certificates/gateway.json ] && cp /certificates/gateway.json /etc/ucentral/gateway.flash [ -f /certificates/restrictions.json ] && cp /certificates/restrictions.json /etc/ucentral/ [ -f /certificates/sign_pubkey.pem ] && cp /certificates/sign_pubkey.pem /etc/ucentral/ country=`cat /certificates/ucentral.defaults | jsonfilter -e '@.country'` [ -z "$country" -a -f /etc/uci-defaults/30_uboot-envtools ] && { (. /etc/uci-defaults/30_uboot-envtools) fw_printenv country=$(fw_printenv -n country) } [ -z "$country" ] && country=US echo "options cfg80211 ieee80211_regdom="$country > /etc/modules.conf echo -n $country > /etc/ucentral/country sync exit 0 } boot() { [ -f /etc/ucentral/key.pem ] && return /usr/bin/mount_certs copy_certificates }