summaryrefslogtreecommitdiff
path: root/support/dktools/debian-jessie-build-deb.sh
blob: 056c075b341e38fb3ddfea8b14d7aaab9c23b68c (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
#! /bin/sh

umask 022

VERSION=`cat version.txt`

# 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


# Build the package, save output for later inspection

if [ "X$DEB_SIGN_KEYID" != "X" ]
then
  dpkg-buildpackage 2>&1 | tee ../dpkg-buildpackage.out
else
  dpkg-buildpackage -us -uc 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