-
Notifications
You must be signed in to change notification settings - Fork 31
/
build-package.bash
executable file
·48 lines (35 loc) · 1.09 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
#!/bin/bash -ex
DEBDIR="./debianstatic"
DEBNAME=${1,,}
BRANCH=${2}
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 -1 --pretty=format:%h.%ai.%s ${1} > commitstring.txt
export DEBFULLNAME=`git log -1 --pretty=format:%an ${1}`
export DEBEMAIL=`git log -1 --pretty=format:%ae ${1}`
export DEBBRANCH=`echo "${BRANCH}" | sed 's/[\/\_]/-/g'`
export DEBPKGVER=`git log -1 --pretty=oneline --abbrev-commit ${1}`
pushd ${1}
tar czf ../packagebuild/${DEBNAME}.tar.gz *
popd
pushd packagebuild
rsync -ar ../${DEBDIR}/ debian/
cat > /tmp/sed.script << EOF
s%{{name}}%${DEBNAME}%
EOF
find . -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 -l "${DEBBRANCH}" -u low "${DEBPKGVER}"
debuild --no-lintian --no-tgz-check -us -uc
popd
mkdir -p tarballs && mv packagebuild/${DEBNAME}.tar.gz tarballs/${1}_${DEBBRANCH}.tar.gz
ls -l .