51d023aa04e808f200a7ad02d09f94b2cb50f252
[selector.git] / mkdeb.sh
1 #!/bin/bash
2
3 #
4 #  selector is a simple shell command for selection of strings with a
5 #  dynamic pattern-matching.
6 #
7 #  Copyright (c) 2009 Francois Fleuret
8 #  Written by Francois Fleuret <francois.fleuret@idiap.ch>
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 VERSION=1.0-R`git log | grep ^commit | wc -l | sed -e "s/[^0-9]//g"`
29 PACKAGE=/tmp/selector_${VERSION}_i386.deb
30 BIN_PATH="usr/bin"
31 MAN_PATH="usr/share/man/man1"
32 make -k
33
34 TMP=`mktemp -d /tmp/deb.XXXXXX`
35
36 for d in DEBIAN ${BIN_PATH} ${MAN_PATH}; do
37     mkdir -p ${TMP}/${d}
38 done
39
40 LIB_DEPENDS=$(dpkg-shlibdeps -O ./selector | grep Depends | sed -e "s/^.*Depends=//")
41
42 cat > ${TMP}/DEBIAN/control <<EOF
43 Package: selector
44 Version: ${VERSION}
45 Maintainer: Francois Fleuret <francois@fleuret.org>
46 Architecture: i386
47 Depends: ${LIB_DEPENDS}
48 Description: A command line for dynamic string-matching
49  This is a command line for dynamic string selection. As you type a
50  list of substrings separated by ';', or a regexp, the display is
51  updated in real time to show only the matching lines. The main usage
52  of selector is as an efficient search in the shell command
53  history. With the correct option, it will inject the selected line
54  into the virtual tty input buffer, hence allowing the user to edit
55  the line and execute it as a standard command.
56 EOF
57
58 cp ./selector ${TMP}/${BIN_PATH}
59 cp ./selector.1 ${TMP}/${MAN_PATH}
60 gzip ${TMP}/${MAN_PATH}/selector.1
61
62 dpkg-deb --build ${TMP} ${PACKAGE}
63
64 dpkg --contents ${PACKAGE}
65
66 rm -rf ${TMP}