-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkDebPkg
executable file
·113 lines (92 loc) · 3.07 KB
/
mkDebPkg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
# Construct debianized package for cryptmount
# RW Penney, June 2010
PACKAGE=cryptmount
VERSION=`sed -n 's/^AC_INIT[^,]*, *\([^,)]*\).*/\1/p' ../configure.ac`
PSEUDO_VERSION=""
DEBDIR=$(dirname $(realpath $0))
UPSDIR=..
# $VERSION refers to the true version number associated with a *.tar.gz file
# $PSEUDO_VERSION is the stable release number for which a .deb should be generated
printHelp() {
cat <<EOF
Syntax: $0 [-d|--upstream-dir DIR] [--pseudo-version N] [-u|--upstream-version]
Upstream-version: ${VERSION}
Upstream-directory: `realpath ${UPSDIR}`
EOF
}
while [ $# -gt 0 ]; do
case "$1" in
-d|--upstream-dir)
UPSDIR="$2"
shift ;;
--pseudo-version)
PSEUDO_VERSION="$2"
shift ;;
-u|--upstream-version)
VERSION="$2"
shift ;;
-h|--help)
printHelp; exit 0 ;;
-*)
echo "Unrecognized option \"$1\""
printHelp; exit 1 ;;
esac
shift
done
if [ -z "${PSEUDO_VERSION}" ]; then
PSEUDO_VERSION="${VERSION}"
fi
SRCPKG=$(realpath ${UPSDIR})/"${PACKAGE}-${VERSION}.tar.gz"
if [ ! -r "${SRCPKG}" ]; then
echo "Upstream package ${SRCPKG} is not readable"
exit 1
fi
echo "Building Debian version ${PSEUDO_VERSION} from ${SRCPKG} ..."
DEBFILES="changelog control copyright \
docs cryptmount.lintian-overrides \
rules preinst postinst postrm watch \
patches/ source/ upstream/"
debtransform="s,/usr/local/etc/,/etc/,g; \
s,/usr/local/bin/,/usr/bin/,g; \
s,/usr/local/sbin/,/usr/sbin/,g"
TXFILES="INSTALL.md README.md README.sshfs cmtab.example"
TMPDIR=/tmp/cm-deb-${VERSION}-$$
PKGDIR="${TMPDIR}/${PACKAGE}-${PSEUDO_VERSION}"
export QUILT_PATCHES=debian/patches
export QUILT_PATCH_OPTS="--reject-format=unified"
export QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
test -d "${TMPDIR}" || mkdir "${TMPDIR}"
tar -C "${TMPDIR}" -zxf ${SRCPKG}
if [ "${PSEUDO_VERSION}" != "${VERSION}" ]; then
mv "${TMPDIR}/${PACKAGE}-${VERSION}" "${PKGDIR}"
fi
test -d patches || mkdir patches
(cd "${PKGDIR}"; test -d debian || mkdir debian)
if [ -n "${DEBFILES}" ]; then
tar -C "${DEBDIR}" -cf - ${DEBFILES} | \
tar -C "${PKGDIR}/debian" -xpf -
(cd "${PKGDIR}"; rm -f debian/p*.ex)
fi
cd "${PKGDIR}"
quilt new docfiles-pathnames.patch
for fl in ${TXFILES}; do
quilt add "${fl}"
sed "${debtransform}" ${fl} > ${fl}-debtx && mv ${fl}-debtx ${fl}
done
cat <<EOF | quilt header -r
Description: Correct installation pathnames in documentation
Some documentation files not installed except in Debian packaging
Author: RW Penney <cryptmount@rwpenney.uk>
Forwarded: not-needed
EOF
quilt refresh
cd "${TMPDIR}"
cp ${SRCPKG} ${TMPDIR}/${PACKAGE}_${PSEUDO_VERSION}.orig.tar.gz
test -e ${SRCPKG}.sig && cp ${SRCPKG}.sig ${TMPDIR}/${PACKAGE}_${PSEUDO_VERSION}.orig.tar.gz.sig
dpkg-source -b ${TMPDIR}/${PACKAGE}-${PSEUDO_VERSION}
cd "${DEBDIR}"
mv ${TMPDIR}/${PACKAGE}_* ./
rm -rf ${TMPDIR}
# vim: set ts=4 sw=4 et: