certificates: add a mount_cert helper script

Fixes: WIFI-12461
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-04-11 09:26:18 +02:00
parent 28623fb4b3
commit 3aa1ff70bb

View File

@@ -0,0 +1,15 @@
#!/bin/sh
. /lib/functions.sh
mkdir -p /certificates
mtd=$(find_mtd_index certificates)
if [ "$(head -c 4 /dev/mtd$mtd)" == "hsqs" ]; then
mount -t squashfs /dev/mtdblock$mtd /certificates
else
[ -n "$mtd" -a -f /sys/class/mtd/mtd$mtd/oobsize ] && ubiattach -p /dev/mtd$mtd
if [ -n "$(ubinfo -a | grep certificates)" ]; then
[ -e /dev/ubi0 ] && mount -t ubifs ubi0:certificates /certificates
[ -e /dev/ubi1 ] && mount -t ubifs ubi1:certificates /certificates
fi
fi