mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
35 lines
722 B
Bash
Executable File
35 lines
722 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# make sure we have a tar file
|
|
[ -f /tmp/certs.tar ] || exit 1
|
|
|
|
. /lib/functions.sh
|
|
|
|
# amke sure the cert partition is mounted
|
|
mount_certs
|
|
|
|
# make sure that this is a UBI volume
|
|
ubi=$(grep certificates /proc/mounts | tail -n 1 | grep ubi)
|
|
[ -z "$ubi" ] && exit 1
|
|
|
|
# extract the certificates
|
|
mkdir -p /tmp/certs
|
|
tar x -C /tmp/certs -f /tmp/certs.tar
|
|
|
|
# make sure the required files exist
|
|
[ -f /tmp/certs/cas.pem -a -f /tmp/certs/key.pem -a -f /tmp/certs/cert.pem ] || exit 1
|
|
|
|
# copy the certificates to /etc
|
|
cp /tmp/certs/*.pem /certificates
|
|
|
|
# copy dev-id or gateway.json
|
|
for a in gateway.json; do
|
|
if [ -f /tmp/certs/$a ]; then
|
|
cp /tmp/certs/$a /certificates
|
|
else
|
|
rm -f /certificates/$a
|
|
fi
|
|
done
|
|
|
|
exit 0
|