| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | set -e |
| 3 | |
| 4 | readonly programName="${0##*/}" |
| 5 | |
| 6 | programMessagescip-shell shell brltty 6.9.1-1 programMessage().() { |
| 7 | local message="${1}" |
| 8 | |
| 9 | echoscip-shell system . . echo. "${programName}: ${message}" |
| 10 | } |
| 11 | |
| 12 | syntaxErrorscip-shell shell brltty 6.9.1-1 syntaxError().() { |
| 13 | local message="${1}" |
| 14 | |
| 15 | programMessagescip-shell shell brltty 6.9.1-1 programMessage(). "${message}" |
| 16 | exit 2 |
| 17 | } |
| 18 | |
| 19 | semanticErrorscip-shell shell brltty 6.9.1-1 semanticError().() { |
| 20 | local message="${1}" |
| 21 | |
| 22 | programMessagescip-shell shell brltty 6.9.1-1 programMessage(). "${message}" |
| 23 | exit 3 |
| 24 | } |
| 25 | |
| 26 | makeIconscip-shell shell brltty 6.9.1-1 makeIcon().() { |
| 27 | local name="${1}" |
| 28 | local size="${2}" |
| 29 | |
| 30 | convert "${imageFile}" -resize "${size}" "res/drawable-${name}/${imageName}.png" |
| 31 | } |
| 32 | |
| 33 | [scip-shell system . . `[`. "${#}" -ge 1 ] || syntaxErrorscip-shell shell brltty 6.9.1-1 syntaxError(). "missing image file" |
| 34 | imageFile="${1}" |
| 35 | shift 1 |
| 36 | |
| 37 | [scip-shell system . . `[`. "${#}" -eq 0 ] || syntaxErrorscip-shell shell brltty 6.9.1-1 syntaxError(). "too many parameters" |
| 38 | |
| 39 | [scip-shell system . . `[`. -f "${imageFile}" ] || semanticErrorscip-shell shell brltty 6.9.1-1 semanticError(). "image file not found: ${imageFile}" |
| 40 | [scip-shell system . . `[`. -r "${imageFile}" ] || semanticErrorscip-shell shell brltty 6.9.1-1 semanticError(). "image file not readable: ${imageFile}" |
| 41 | |
| 42 | imageName="${imageFile%.*}" |
| 43 | |
| 44 | makeIconscip-shell shell brltty 6.9.1-1 makeIcon(). ldpi 36x36 |
| 45 | makeIconscip-shell shell brltty 6.9.1-1 makeIcon(). mdpi 48x48 |
| 46 | makeIconscip-shell shell brltty 6.9.1-1 makeIcon(). hdpi 72x72 |
| 47 | makeIconscip-shell shell brltty 6.9.1-1 makeIcon(). xhdpi 96x96 |
| 48 | |
| 49 | exit 0 |