Update zimaos-fix.sh

This commit is contained in:
老竭力 2024-07-12 16:37:33 +08:00 committed by GitHub
parent f44a2804ac
commit 0aac6782a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,8 @@ temp_file=$(mktemp)
tmpRoot="/tmp/root"
mkdir -p "$tmpRoot"
rootfs=$(mount | grep ' / ' | cut -d ' ' -f 1)
p8=$(mount | grep ' /DATA ' | cut -d ' ' -f 1)
mount "$rootfs" /tmp/root > /dev/null 2>&1
find /mnt/overlay/etc/ -type f -exec sh -c 'for f; do [ ! -s "$f" ] && echo "$f"; done' sh {} + > "$temp_file"
@ -20,6 +22,17 @@ done < "$temp_file"
rm "$temp_file"
umount "$tmpRoot"
if [ -n "$p8" ]; then
p8_size=$(df -BG | grep "$p8" | awk '{print $2}')
p8_size=${p8_size%G}
if [ "$p8_size" -lt 2 ]; then
echo "Expanding..."
resize2fs "$p8"
echo "Partition 8 expanded."
fi
fi
if [ $counter -gt 0 ]; then
echo "Done! Please reboot your device."
exit 0