Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Vasyl Gello | bc4bce8 | 2019-07-01 13:52:35 +0000 | [diff] [blame^] | 3 | PRODUCT_OUT="$1" |
| 4 | WIDTH="$2" |
| 5 | HEIGHT="$3" |
| 6 | HALF_RES="$4" |
| 7 | |
| 8 | OUT="$PRODUCT_OUT/obj/BOOTANIMATION" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 9 | |
| 10 | if [ "$HEIGHT" -lt "$WIDTH" ]; then |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame] | 11 | IMAGEWIDTH="$HEIGHT" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 12 | else |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame] | 13 | IMAGEWIDTH="$WIDTH" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 14 | fi |
| 15 | |
Dan Pasanen | b782210 | 2017-04-03 08:30:16 -0500 | [diff] [blame] | 16 | IMAGESCALEWIDTH="$IMAGEWIDTH" |
| 17 | IMAGESCALEHEIGHT=$(expr $IMAGESCALEWIDTH / 3) |
Asher Simonds | e035b9a | 2017-01-16 21:52:24 -0600 | [diff] [blame] | 18 | |
Dan Pasanen | b782210 | 2017-04-03 08:30:16 -0500 | [diff] [blame] | 19 | if [ "$HALF_RES" = "true" ]; then |
| 20 | IMAGEWIDTH=$(expr $IMAGEWIDTH / 2) |
| 21 | fi |
| 22 | |
| 23 | IMAGEHEIGHT=$(expr $IMAGEWIDTH / 3) |
| 24 | |
| 25 | RESOLUTION=""$IMAGEWIDTH"x"$IMAGEHEIGHT"" |
| 26 | |
| 27 | for part_cnt in 0 1 2 3 4 |
| 28 | do |
Vasyl Gello | bc4bce8 | 2019-07-01 13:52:35 +0000 | [diff] [blame^] | 29 | mkdir -p "$OUT/bootanimation/part$part_cnt" |
Dan Pasanen | b782210 | 2017-04-03 08:30:16 -0500 | [diff] [blame] | 30 | done |
Dan Pasanen | 91f7620 | 2017-07-06 08:21:30 -0500 | [diff] [blame] | 31 | tar xfp "vendor/lineage/bootanimation/bootanimation.tar" -C "$OUT/bootanimation/" |
Dan Pasanen | b782210 | 2017-04-03 08:30:16 -0500 | [diff] [blame] | 32 | mogrify -resize $RESOLUTION -colors 250 "$OUT/bootanimation/"*"/"*".png" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 33 | |
| 34 | # Create desc.txt |
Dan Pasanen | b782210 | 2017-04-03 08:30:16 -0500 | [diff] [blame] | 35 | echo "$IMAGESCALEWIDTH $IMAGESCALEHEIGHT" 60 > "$OUT/bootanimation/desc.txt" |
Dan Pasanen | 91f7620 | 2017-07-06 08:21:30 -0500 | [diff] [blame] | 36 | cat "vendor/lineage/bootanimation/desc.txt" >> "$OUT/bootanimation/desc.txt" |
Dan Pasanen | 24a1cc9 | 2016-12-28 22:59:21 -0600 | [diff] [blame] | 37 | |
| 38 | # Create bootanimation.zip |
| 39 | cd "$OUT/bootanimation" |
| 40 | |
| 41 | zip -qr0 "$OUT/bootanimation.zip" . |