2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 06:35:33 +00:00

Make sure that ls reads the actual size without being confsued by symbolic links

This commit is contained in:
Jarrod Johnson
2026-09-01 16:35:56 -04:00
parent 6d0e364f0e
commit 31d1d38ac6
@@ -44,7 +44,11 @@ if grep '^Format: confluent_crypted' /tmp/rootimg.info > /dev/null; then
fi
cipher=$(head -n 1 /tmp/rootimg.key)
key=$(tail -n 1 /tmp/rootimg.key)
len=$(ls -l /mnt/remoteimg/rootimg.sfs | awk '{print $3}')
rootimgfile=/mnt/remoteimg/rootimg.sfs
while [ -L "$rootimgfile" ]; do
rootimgfile=$(readlink -f "$rootimgfile")
done
len=$(ls -l $rootimgfile | awk '{print $3}')
len=$(((len-4096)/512))
dmsetup create cryptimg --table "0 $len crypt $cipher $key 0 $loopdev 8"
/opt/confluent/bin/confluent_imginfo /dev/mapper/cryptimg > /tmp/rootimg.info