mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
34 lines
728 B
Bash
Executable File
34 lines
728 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# make sure we have a tar file
|
|
[ -f /tmp/certs.tar ] || exit 1
|
|
|
|
# check if there is a certificates partition
|
|
. /lib/functions.sh
|
|
mtd="$(find_mtd_index certificates)"
|
|
[ -z "$mtd" ] && exit 1
|
|
|
|
# check if this is ubi or squashfs
|
|
ubi="$(ubinfo -a | grep certificates)"
|
|
|
|
# extract the certificates
|
|
mkdir /tmp/certs
|
|
cd /tmp/certs
|
|
tar xf /tmp/certs.tar
|
|
|
|
# copy the certificates to /etc
|
|
cp *.pem dev-id /etc/ucentral/
|
|
|
|
# persistently store the certificates
|
|
if [ -z "$ubi" ]; then
|
|
# squashfs
|
|
mtd write /tmp/certs/squashfs /dev/mtd$mtd
|
|
else
|
|
# ubi
|
|
[ -e /dev/ubi0 ] && mount -t ubifs ubi0:certificates /certificates
|
|
[ -e /dev/ubi1 ] && mount -t ubifs ubi1:certificates /certificates
|
|
cp *.pem dev-id /certificates/
|
|
fi
|
|
|
|
exit 0
|