forked from adrelanos/anon-gw-first-run-notice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·79 lines (63 loc) · 1.67 KB
/
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
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
#!/bin/bash
## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
## generic deb build script version 0.2
set -x
if [ -f /usr/lib/pre.bsh ]; then
source /usr/lib/pre.bsh
fi
set -e
set -o pipefail
package_name="$(basename $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))"
## {{ get upstream version number from debian/changelog
command -v dpkg-parsechangelog >/dev/null
OIFS="${IFS}"
NIFS=$'\n'
IFS="${NIFS}"
for line in $(dpkg-parsechangelog); do
## Example line:
## Version: 0.1-1
IFS="${OIFS}"
read -r first second _ <<< "$line"
## Example first:
## Version:
## Example second:
## 0.1-1
first="${first,,}"
## Example first:
## version
if [ "$first" = "version:" ]; then
version="$second"
## Example version:
## 3:0.1-1
version="${version%-*}"
## Example version:
## 3:0.1
version="${version#*:}"
## Example version:
## 0.1
break
fi
done
IFS="${OIFS}"
if [ "$version" = "" ]; then
true "ERROR: variable version is empty."
exit 1
fi
## }} get upstream version number from debian/changelog
./clean
## Explicitly set access time, so we end up with a deterministic debian.tar.gz file.
shopt -s globstar dotglob
touch -t "201308151102.35" ./debian
touch -t "201308151102.35" ./debian/**
shopt -u globstar dotglob
rm --force "../${package_name}_${version}.orig.tar.gz"
git archive \
--format=tar HEAD \
| gzip -n > "../${package_name}_${version}.orig.tar.gz"
ls -la "../${package_name}_${version}.orig.tar.gz"
debuild \
--rootcmd="debian/gain-root-command" \
-sa \
${1+"$@"}