]> git.saurik.com Git - wxWidgets.git/blob - debian/unpack_examples.sh.in
setting a non valid font is permitted, implemented now
[wxWidgets.git] / debian / unpack_examples.sh.in
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
6 WX_EXAMPLES_DIR="/usr/share/doc/wx=V-examples/examples"
7
8 usage() {
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
17 if [ $# -lt 1 ]; then
18 usage
19 fi
20
21 while [ $# -gt 1 ]; do
22 SUBDIRS="$SUBDIRS $1"
23 shift
24 done
25
26 DESTDIR="$1"
27
28 if [ -e $DESTDIR ]; then
29 echo "Destination $DESTDIR already exists. Cowardly exiting."
30 exit 2
31 fi
32
33 if [ -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
37 else
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"
46 fi
47
48 if [ -z "$SUBDIRS" ]; then
49 echo "Nothing to copy from $WX_EXAMPLES_DIR. Aborting."
50 exit 1
51 fi
52
53 mkdir -p $DESTDIR
54 for d in $SUBDIRS; do
55 echo "Copying $WX_EXAMPLES_DIR/$d to $DESTDIR"
56 cp -pr "$WX_EXAMPLES_DIR/$d" "$DESTDIR"
57 done
58
59 echo -n "Unpacking... "
60 find $DESTDIR -name "*.gz" -exec gunzip {} \;
61 echo "done."
62