forked from zba/dtc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deb
executable file
·40 lines (35 loc) · 1.06 KB
/
deb
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
#!/bin/sh
set -e
set -x
VERS=`head -n 1 debian/changelog | cut -d'(' -f2 | cut -d')' -f1 | cut -d'-' -f1`
REL=`head -n 1 debian/changelog | cut -d'(' -f2 | cut -d')' -f1 | cut -d'-' -f2`
PKGNAME=`head -n 1 debian/changelog | cut -d' ' -f1`
if [ -e /etc/redhat-release ] ; then
MKTEMP="mktemp -d -p /tmp"
else
MKTEMP="mktemp -d -t"
fi
TMPDIR=`${MKTEMP} ${PKGNAME}.XXXXXX`
DIRNAME=${PKGNAME}-${VERS}
MYCWD=`pwd`
mkdir -p ${TMPDIR}/${DIRNAME}
cp -auxf * ${TMPDIR}/${DIRNAME}
sed -i "s/__VERSION__/${VERS}/" ${TMPDIR}/${DIRNAME}/${PKGNAME}.spec
mv ${TMPDIR}/${DIRNAME}/debian ${TMPDIR}
rm -rf ${TMPDIR}/${DIRNAME}/.git
cd ${TMPDIR}
tar -czf ${PKGNAME}_${VERS}.orig.tar.gz ${DIRNAME}
mv debian ${TMPDIR}/${DIRNAME}
cd ${DIRNAME}
if [ "${1}" = "--sign" ] ; then
dpkg-buildpackage
else
dpkg-buildpackage -uc -us
fi
cd ${MYCWD}
mv ${TMPDIR}/${PKGNAME}_${VERS}.orig.tar.gz ..
mv ${TMPDIR}/${PKGNAME}_${VERS}-${REL}.dsc ..
mv ${TMPDIR}/${PKGNAME}_${VERS}-${REL}.diff.gz ..
mv ${TMPDIR}/${PKGNAME}*_${VERS}-${REL}*.deb ..
mv ${TMPDIR}/${PKGNAME}*_${VERS}-${REL}*.changes ..
rm -rf ${TMPDIR}