Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
openclipart
generate-png-source.sh
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File generate-png-source.sh of Package openclipart
#!/bin/sh usage() { echo "This script generates a source pngonly source tarball from the svgonly" echo "source tarball." echo echo "Usage: ${0##*/} openclipart-<version>-svgonly.tar.bz2 [output.tar.bz2]" } if test "$1" = "--help" -o -z "$1" -o ! -f "$1" ; then usage exit 1 fi INTAR="$1" OUTTAR="$2" if test -z "$OUTTAR" ; then OUTTAR=${INTAR/svg/png} fi if test -f "$OUTTAR" ; then echo "Error: Output archive $OUTTAR already exists!" echo "If you want to replace the output archive, remove it at first, please!" exit 1; fi TEMPDIR="`mktemp -d /tmp/generate-png-source.sh.XXXXXXXX`" SRCDIR=$TEMPDIR/src OUTDIR=$TEMPDIR/out mkdir $SRCDIR mkdir $OUTDIR echo "Unpacking source tarball ($INTAR)..." tar -xf "$INTAR" -C "$SRCDIR" find "$SRCDIR" -type d -exec chmod 755 {} \; find "$SRCDIR" -type f -exec chmod 644 {} \; # detect names of the top directories SVGDIRNAME=`ls $SRCDIR` PNGDIRNAME=${SVGDIRNAME/svg/png} echo "Removing some broken files..." for path in buildings/perspectival_house_01.svg ; do echo " remove $path" rm -rvf $SRCDIR/$SVGDIRNAME/clipart/$path done echo "Copying documentation..." mkdir $OUTDIR/$PNGDIRNAME for file in `find $SRCDIR/$SVGDIRNAME -mindepth 1 -maxdepth 1 -type f` ; do cp -av $file $OUTDIR/$PNGDIRNAME done mkdir -v $OUTDIR/$PNGDIRNAME/clipart for file in `find $SRCDIR/$SVGDIRNAME/clipart -mindepth 1 -maxdepth 1 -type f` ; do cp -av $file $OUTDIR/$PNGDIRNAME/clipart done echo "Generating .png files using inkscape..." # inkscape is in /opt/gnome/bin IFS_saved="$IFS" IFS=" " export PATH="$PATH:/opt/gnome/bin" for pict_svg in `find $SRCDIR/$SVGDIRNAME/clipart -name "*.svg" -type f ` ; do pict_dir="${pict_svg#$SRCDIR/$SVGDIRNAME/clipart}" pict_dir="${pict_dir%/*}" pict_png="${pict_svg##*/}" pict_png="${pict_png%.svg}.png" mkdir -p "$OUTDIR/$PNGDIRNAME/clipart/$pict_dir" inkscape -f "$pict_svg" -e "$OUTDIR/$PNGDIRNAME/clipart/$pict_dir/$pict_png" # check output if test ! -f "$OUTDIR/$PNGDIRNAME/clipart/$pict_dir/$pict_png" ; then echo "Error: File $OUTDIR/$PNGDIRNAME/clipart/$pict_dir/$pict_png was not generated!" exit 1 fi # optimize output size optipng -o5 $OUTDIR/$PNGDIRNAME/clipart/$pict_dir/$pict_png done IFS="$IFS_saved" echo "Generating output tarball ($OUTTAR)..." tar -cjf "$OUTTAR" -C "$OUTDIR" `ls "$OUTDIR"` echo "Cleaning up..." rm -rf $TPMDIR
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor