de57519892c9e7da4df8fbf65ab11a4e4b732b58
[selector.git] / mkdeb.sh
1 #!/bin/bash
2
3 #
4 #  selector is a simple command line utility for selection of strings
5 #  with a dynamic pattern-matching.
6 #
7 #  Copyright (c) 2009 Francois Fleuret
8 #  Written by Francois Fleuret <francois@fleuret.org>
9 #
10 #  This file is part of selector.
11 #
12 #  selector is free software: you can redistribute it and/or modify
13 #  it under the terms of the GNU General Public License version 3 as
14 #  published by the Free Software Foundation.
15 #
16 #  selector is distributed in the hope that it will be useful, but
17 #  WITHOUT ANY WARRANTY; without even the implied warranty of
18 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 #  General Public License for more details.
20 #
21 #  You should have received a copy of the GNU General Public License
22 #  along with selector.  If not, see <http://www.gnu.org/licenses/>.
23 #
24
25 # This script creates the Debian package. The way it does it is
26 # probably not very conventional. I am open to suggestions.
27
28 set -e
29
30 VERSION=1.0-R$(cat REVISION_NUMBER)
31 PACKAGE=/tmp/selector_${VERSION}_i386.deb
32
33 BIN_PATH="usr/bin"
34 MAN_PATH="usr/share/man/man1"
35
36 make -j -k || exit 1
37
38 strip selector
39
40 TMP=`mktemp -d /tmp/deb.XXXXXX`
41
42 for d in DEBIAN ${BIN_PATH} ${MAN_PATH}; do
43     mkdir -p ${TMP}/${d}
44 done
45
46 mkdir -p debian/control
47
48 LIB_DEPENDS=$(dpkg-shlibdeps -O ./selector | grep Depends | sed -e "s/^.*Depends=//")
49
50 cat > ${TMP}/DEBIAN/control <<EOF
51 Package: selector
52 Version: ${VERSION}
53 Maintainer: Francois Fleuret <francois@fleuret.org>
54 Architecture: i386
55 Depends: ${LIB_DEPENDS}
56 Description: A command line utility for dynamic string-matching
57  This is a command line utility for dynamic string selection. As you
58  type a list of substrings separated by ';', or a regexp, the display
59  is updated in real time to show only the matching lines. The main
60  usage of selector is as an efficient search in the shell command
61  history. With the correct option, it will inject the selected line
62  into the tty input buffer, hence allowing the user to edit the line
63  and execute it as a standard command.
64 EOF
65
66 cp ./selector ${TMP}/${BIN_PATH}
67 cp ./selector.1 ${TMP}/${MAN_PATH}
68 gzip ${TMP}/${MAN_PATH}/selector.1
69
70 dpkg-deb --build ${TMP} ${PACKAGE}
71
72 dpkg --contents ${PACKAGE}
73
74 rm -rf ${TMP}