blob: fee0adcce33e39a81bdbfcab2f2290dbc2c2b69a (
plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#! /bin/sh
umask 022
VERSION=`cat version.txt`
DEBVMAJ=`cat /etc/debian_version | cut -f 1 -d .`
case "X$DEBVMAJ" in
"X8")
DEBVMAJ="jessie"
cp debian/control8 debian/control
;;
"X9")
DEBVMAJ="stretch"
cp debian/control9 debian/control
;;
"X10")
DEBVMAJ="buster"
;;
"X")
echo 'E: Not on a Debian system'
exit 1
;;
*)
echo 'E: Can not handle Debian major version' $DEBVMAJ
exit 1
;;
esac
# Make sure to run the script as unprivileged user
if [ "X$LOGNAME" = "Xroot" ]
then
echo 'ERROR: This script must not be run as root!'
exit 1
fi
# Make sure we are in the correct directory
if [ "X$VERSION" = "X" ]
then
echo 'ERROR: Failed to find version number!'
echo 'Make sure to call this script in the correct directory!'
exit 1
fi
# Make sure the original archive is still in the parent directory
if [ ! -f ../dktools-${VERSION}.tar.gz ]
then
echo 'ERROR: File' ../dktools-${VERSION}.tar.gz 'not found!'
exit 1
fi
# Create a .orig copy of the original archive
if [ -f ../dktools_${VERSION}.orig.tar.gz ]
then
rm -f ../dktools_${VERSION}.orig.tar.gz
fi
ln ../dktools-${VERSION}.tar.gz ../dktools_${VERSION}.orig.tar.gz
# The 'debian' subdirectory must be present
if [ ! -d debian ]
then
echo 'ERROR: Missing directory debian!'
exit 1
fi
NP=`nproc`
if [ "X" != "X$NP" -a "$NP" -gt 1 ]
then
MAKEFLAGS="-j$NP"
fi
# Build the package, save output for later inspection
if [ "X$DEB_SIGN_KEYID" != "X" ]
then
dpkg-buildpackage $MAKEFLAGS 2>&1 | tee ../dpkg-buildpackage.out
else
dpkg-buildpackage -us -uc $MAKEFLAGS 2>&1 | tee ../dpkg-buildpackage.out
fi
# Finally list the created packages and show some notes
echo 'If the dpkg-buildpackage command succeeded, you should find the'
echo '*.deb archive in the parent directory.'
echo ''
ls -l ../dktools*${VERSION}*.deb
echo ''
echo 'Otherwise you should inspect the ../dpkg-buildpackage.out file'
echo 'for error messages.'
echo ''
exit 0
|