wxWidgets/debian/unpack_examples.sh.in
Dimitri Schoolwerth 7e528ef6d1 Synchronised svn:eol-style and svn:executable properties of some file types.
Changed the properties of the following file types:

.am .m4: LF
.plist .plist.in: native
.guess .sh .sh.in .sub: LF, executable


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-18 18:00:07 +00:00

63 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Unpack compressed examples from the packaged documentation
# into a directory where the user can compile and/or run them.
WX_EXAMPLES_DIR="/usr/share/doc/wx=V-examples/examples"
usage() {
echo "$0 [subdir [subdir] ...] dest_dir"
echo " subdir - a subdir of $WX_EXAMPLES_DIR to unpack."
echo " dest_dir - location for the unpacked examples."
echo
echo "If no subdirs are supplied explicitly, all examples will be unpacked."
exit 1
}
if [ $# -lt 1 ]; then
usage
fi
while [ $# -gt 1 ]; do
SUBDIRS="$SUBDIRS $1"
shift
done
DESTDIR="$1"
if [ -e $DESTDIR ]; then
echo "Destination $DESTDIR already exists. Cowardly exiting."
exit 2
fi
if [ -z "$SUBDIRS" ]; then
for d in $(cd $WX_EXAMPLES_DIR 2> /dev/null && ls -d * 2> /dev/null); do
[ -d "$WX_EXAMPLES_DIR/$d" ] && SUBDIRS="$SUBDIRS $d"
done
else
for d in $SUBDIRS; do
if [ -d "$WX_EXAMPLES_DIR/$d" ]; then
_SUBDIRS="$d"
else
echo "Subdir $WX_EXAMPLES_DIR/$d does not exist. Skipping."
fi
done
SUBDIRS="$_SUBDIRS"
fi
if [ -z "$SUBDIRS" ]; then
echo "Nothing to copy from $WX_EXAMPLES_DIR. Aborting."
exit 1
fi
mkdir -p $DESTDIR
for d in $SUBDIRS; do
echo "Copying $WX_EXAMPLES_DIR/$d to $DESTDIR"
cp -pr "$WX_EXAMPLES_DIR/$d" "$DESTDIR"
done
echo -n "Unpacking... "
find $DESTDIR -name "*.gz" -exec gunzip {} \;
echo "done."