Skip to content

Commit

Permalink
add size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jefino9488 committed Nov 21, 2024
1 parent d60e5ab commit f5422fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Builder/scripts/repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ if [[ "$EXT4" == true ]]; then
fi
echo -e "\e[1;33m - ${i}.img free: $File_Type \e[0m"
}
for i in product system system_ext vendor; do
eval "${i}_size_orig=$(sudo du -sb "$WORKSPACE/${DEVICE}/images/${i}" | awk '{print $1}')"
if [[ "$(eval echo "\${${i}_size_orig}")" -lt 104857600 ]]; then
size=$(echo "$(eval echo "\${${i}_size_orig}") * 15 / 10 / 4096 * 4096" | bc)
elif [[ "$(eval echo "\${${i}_size_orig}")" -lt 1073741824 ]]; then
size=$(echo "$(eval echo "\${${i}_size_orig}") * 108 / 100 / 4096 * 4096" | bc)
else
size=$(echo "$(eval echo "\${${i}_size_orig}") * 103 / 100 / 4096 * 4096" | bc)
fi
eval "${i}_size=$(echo "$size * 4096 / 4096 / 4096" | bc)"
done

for i in product system system_ext vendor; do
if [[ ! -d "$WORKSPACE/${DEVICE}/images/$i" ]]; then
Expand Down

0 comments on commit f5422fe

Please sign in to comment.