Files
wlan-ap/feeds/tip/certificates/files/etc/init.d/early_boot
John Crispin 0db44ca55b cloud_discovery: add insta EST support
Fixes: WIFI-14694
Signed-off-by: John Crispin <john@phrozen.org>
2025-07-01 07:18:54 +02:00

31 lines
1.1 KiB
Bash
Executable File

#!/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
exit 0
}
boot() {
[ -f /etc/ucentral/key.pem ] && return
/usr/bin/mount_certs
copy_certificates
}