-
Notifications
You must be signed in to change notification settings - Fork 27
/
gen_deb_pkg.sh
executable file
·68 lines (54 loc) · 1.64 KB
/
gen_deb_pkg.sh
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
#!/usr/bin/env sh
set -e
set -u
##------------------------------------------------------------
P_NAME='nagios-plugin-check-logfiles'
P_AUTHOR='Gerhard Laußer <[email protected]>'
CL_DEB="$( dirname "$0" )/debian/changelog"
CL_US="$( dirname $0 )/ChangeLog"
readonly P_NAME P_AUTHOR CL_DEB CL_US
##------------------------------------------------------------
rebuildChangelog() {
awk -vRS='* ' \
-vAUTHOR="$P_AUTHOR" \
-vNAME="$P_NAME" \
'function convDate(ts) {
cmd="date --rfc-2822 -d " gensub(/\./, "-", "g", ts)
cmd | getline converted
return converted
}
{
v=$1 # version
if ($2 == "-") {
d=$3 # date
$1=$2=$3="" # clear the previous fields
} else {
d=$2 # date
$1=$2="" # clear the previous fields
}
d=convDate(d)
gsub(/^[ \t]+|[ \t]+$/, "")
t=$0
if (length(v) && length(d) && length(t))
print NAME " (" v ") stable; urgency=medium\n\n * " t "\n\n -- " AUTHOR " " d "\n"
}'
}
##------------------------------------------------------------
buildPkg() {
debuild -uc -us
}
##------------------------------------------------------------
autoReconf() {
[ -f ./configure ] || {
autoreconf
}
}
##------------------------------------------------------------
main() {
autoReconf
rebuildChangelog <"$CL_US" >"$CL_DEB"
buildPkg
}
##------------------------------------------------------------
##------------------------------------------------------------
main "$@"