]> git.saurik.com Git - wxWidgets.git/blame_incremental - debian/unpack_examples.sh.in
return updated wxFONT*_* values
[wxWidgets.git] / debian / unpack_examples.sh.in
... / ...
CommitLineData
1#!/bin/bash
2#
3# Unpack compressed examples from the packaged documentation
4# into a directory where the user can compile and/or run them.
5
6WX_EXAMPLES_DIR="/usr/share/doc/wx=V-examples/examples"
7
8usage() {
9 echo "$0 [subdir [subdir] ...] dest_dir"
10 echo " subdir - a subdir of $WX_EXAMPLES_DIR to unpack."
11 echo " dest_dir - location for the unpacked examples."
12 echo
13 echo "If no subdirs are supplied explicitly, all examples will be unpacked."
14 exit 1
15}
16
17if [ $# -lt 1 ]; then
18 usage
19fi
20
21while [ $# -gt 1 ]; do
22 SUBDIRS="$SUBDIRS $1"
23 shift
24done
25
26DESTDIR="$1"
27
28if [ -e $DESTDIR ]; then
29 echo "Destination $DESTDIR already exists. Cowardly exiting."
30 exit 2
31fi
32
33if [ -z "$SUBDIRS" ]; then
34 for d in $(cd $WX_EXAMPLES_DIR 2> /dev/null && ls -d * 2> /dev/null); do
35 [ -d "$WX_EXAMPLES_DIR/$d" ] && SUBDIRS="$SUBDIRS $d"
36 done
37else
38 for d in $SUBDIRS; do
39 if [ -d "$WX_EXAMPLES_DIR/$d" ]; then
40 _SUBDIRS="$d"
41 else
42 echo "Subdir $WX_EXAMPLES_DIR/$d does not exist. Skipping."
43 fi
44 done
45 SUBDIRS="$_SUBDIRS"
46fi
47
48if [ -z "$SUBDIRS" ]; then
49 echo "Nothing to copy from $WX_EXAMPLES_DIR. Aborting."
50 exit 1
51fi
52
53mkdir -p $DESTDIR
54for d in $SUBDIRS; do
55 echo "Copying $WX_EXAMPLES_DIR/$d to $DESTDIR"
56 cp -pr "$WX_EXAMPLES_DIR/$d" "$DESTDIR"
57done
58
59echo -n "Unpacking... "
60find $DESTDIR -name "*.gz" -exec gunzip {} \;
61echo "done."
62