generate-bootanimation.sh 933 Bytes
Newer Older
1 2
#!/bin/bash

3 4 5 6 7 8
PRODUCT_OUT="$1"
WIDTH="$2"
HEIGHT="$3"
HALF_RES="$4"

OUT="$PRODUCT_OUT/obj/BOOTANIMATION"
9 10

if [ "$HEIGHT" -lt "$WIDTH" ]; then
11
    IMAGEWIDTH="$HEIGHT"
12
else
13
    IMAGEWIDTH="$WIDTH"
14 15
fi

Dan Pasanen's avatar
Dan Pasanen committed
16 17
IMAGESCALEWIDTH="$IMAGEWIDTH"
IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3)
18

Dan Pasanen's avatar
Dan Pasanen committed
19 20 21 22 23 24 25 26 27 28
if [ "$HALF_RES" = "true" ]; then
    IMAGEWIDTH=$(expr $IMAGEWIDTH / 2)
fi

IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3)

RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT""

for part_cnt in 0 1 2 3 4
do
29
    mkdir -p "$OUT/bootanimation/part$part_cnt"
Dan Pasanen's avatar
Dan Pasanen committed
30
done
31
tar xfp "vendor/lineage/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/"
Dan Pasanen's avatar
Dan Pasanen committed
32
mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png"
33 34

# Create desc.txt
Dan Pasanen's avatar
Dan Pasanen committed
35
echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt"
36
cat "vendor/lineage/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt"
37 38 39 40 41

# Create bootanimation.zip
cd "$OUT/bootanimation"

zip -qr0 "$OUT/bootanimation.zip" .