forked from RackHD/on-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-package.bash
executable file
·62 lines (49 loc) · 1.36 KB
/
build-package.bash
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
#!/bin/bash
DEBDIR="./debianstatic/${1}"
BRANCH=${2}
set -x
if [ ! -d "${DEBDIR}" ]; then
echo "no such debian directory ${DEBDIR}"
exit 1
fi
rm -rf ${1}_*
rm -rf packagebuild
mkdir -p packagebuild/debian
git log -n 1 --pretty=format:%h.%ai.%s > commitstring.txt
if [ -z "$DEBFULLNAME" ]; then
export DEBFULLNAME=`git log -n 1 --pretty=format:%an`
fi
if [ -z "$DEBEMAIL" ]; then
export DEBEMAIL=`git log -n 1 --pretty=format:%ae`
fi
if [ -z "$DEBBRANCH" ]; then
export DEBBRANCH=`echo "${BRANCH}" | sed 's/[\/\_]/-/g'`
fi
if [ -z "$DEBPKGVER" ]; then
export DEBPKGVER=`git log -n 1 --pretty=oneline --abbrev-commit`
fi
if [ -z "$DCHOPTS" ]; then
export DCHOPTS="-l ${DEBBRANCH} -u low ${DEBPKGVER}"
fi
echo "DEBDIR: $DEBDIR"
echo "DEBFULLNAME: $DEBFULLNAME"
echo "DEBEMAIL: $DEBEMAIL"
echo "DEBBRANCH: $DEBBRANCH"
echo "DEBPKGVER: $DEBPKGVER"
echo "DCHOPTS: $DCHOPTS"
rsync -ar --exclude=packagebuild \
--exclude=debianstatic . packagebuild
pushd packagebuild
rsync -ar ../${DEBDIR}/ debian/
cat > /tmp/sed.script << EOF
s%{{name}}%${3}%
EOF
find ./debian -type f -iname "*.in" -print0 | while IFS= read -r -d $'\0' file; do
outFile=$(echo $file | sed -f /tmp/sed.script)
cat $file | sed -f /tmp/sed.script > ${outFile%.in}
rm $file
done
rm /tmp/sed.script
dch ${DCHOPTS}
debuild --no-lintian --no-tgz-check -us -uc
popd