-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·46 lines (37 loc) · 919 Bytes
/
build
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
#!/bin/bash
# Usage(create source package): ../build
# Usage(create binary package): ../build --binary
arg1="$1"
if [[ ! -d src ]]; then
echo 'Execute this script in package directory'
exit 1
fi
set -e
shopt -s extglob
[[ -x prebuild ]] && ./prebuild
version=$(dpkg-parsechangelog --show-field Version)
version_noepoch=$(echo "$version" | cut -d: -f2-)
version_upstream=${version_noepoch/%-*([^-])/}
pkgname=$(dpkg-parsechangelog --show-field Source)
tgzname="$pkgname"_"$version_upstream".orig.tar.gz
rm -rf dist
rm -f -- *.diff.gz *.build *.dsc *.changes *.upload *.deb
if [[ "$arg1" = "--binary" ]]; then
cp -r src dist
cp -r debian dist/debian
else
if [[ ! -f "$tgzname" ]]; then
tar -C src -czf "$tgzname" ./
fi
mkdir dist
cp -r debian dist/debian
fi
dir=$(pwd)
cd dist
if [[ "$arg1" = "--binary" ]]; then
debuild --no-tgz-check -b
else
debuild --tgz-check -S
fi
cd "$dir"
exit 0