mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-13 06:31:01 +01:00
b6ed251c88
- Camera - CO2 - Flow - Gas - Line (decline/incline/stagnation) - Microphone - Motion - Move - Pressure - Rain - Signal (0-4) - Smoke - Television (on/off) - Zoom
40 lines
849 B
Bash
Executable File
40 lines
849 B
Bash
Executable File
#!/bin/sh
|
|
|
|
for file in $1*.svg; do
|
|
|
|
if [[ $file != 'none'* ]]; then
|
|
|
|
png=`echo $file | sed s/.svg/.png/`
|
|
|
|
# 1. Clean up SVG file.
|
|
if type xmllint &>/dev/null; then
|
|
|
|
# Should be pre-installed on OS X.
|
|
xmllint $file -o $file --pretty 1
|
|
|
|
fi
|
|
|
|
# 2. Convert SVG files to PNG.
|
|
if [ ! -f "$png" ]; then
|
|
|
|
if type rsvg-convert &>/dev/null; then
|
|
|
|
# Can be installed with Homebrew. (Installation is slow, but conversion is fast.)
|
|
# brew install librsvg
|
|
echo "rsvg-convert: converting $file"
|
|
rsvg-convert $file -o $png
|
|
|
|
elif type svgexport &>/dev/null; then
|
|
|
|
# Can be installed with NPM. (Installation is fast, but conversion is slow.)
|
|
# npm install -g svgexport
|
|
echo "svgexport: converting $file"
|
|
svgexport $file $png
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
done
|