#!/bin/sh # # Sanity checks # if [ ! -e theme.in ]; then exit 1 fi if [ $# -lt 1 ]; then exit 1 fi # # Helper functions # struct_name() { name=${1%.*} echo "pixmap_$name" } # # Begin processing # echo "/*" echo " * Part 1 - Generic header part" echo " */" cat theme.in echo echo "/*" echo " * Part 2 - Forward theme struct declarations" echo " */" first=yes for size in $@; do if [ $first = "yes" ]; then THEMENAME="usplash_theme" first=no else THEMENAME="usplash_theme_$size" fi echo "struct usplash_theme $THEMENAME;" done echo echo "/*" echo " * Step 3 - Actual theme struct defs" echo " */" first=yes while [ 1 ]; do size="$1" if [ -z "$size" ]; then exit 0 fi if [ $first = "yes" ]; then THEMENAME="usplash_theme" first=no else THEMENAME="usplash_theme_$size" fi if [ -z "$2" ]; then THEMENEXT="NULL" else THEMENEXT="&usplash_theme_$2" fi shift PGFG_PIX="progressfg_$size.png" PGFG_STRUCT=$(struct_name "$PGFG_PIX") PGBG_PIX="progressbg_$size.png" PGBG_STRUCT=$(struct_name "$PGBG_PIX") BG_PIX="background_$size.png" BG_STRUCT=$(struct_name "$BG_PIX") PROGRESS_WIDTH=$( identify "$PGFG_PIX" | cut -d' ' -f3 | cut -dx -f1) PROGRESS_HEIGHT=$( identify "$PGFG_PIX" | cut -d' ' -f3 | cut -dx -f2) WIDTH=${size%x*} HEIGHT=${size#*x} if [ $(( $WIDTH / 16 )) -eq $(( $HEIGHT / 9 )) ]; then RATIO="USPLASH_16_9" else RATIO="USPLASH_4_3" fi cat <