annotate make-debian-package @ 44:6999afa6fff3

Update Building instructions; minor build system bug fixes.
author David Barts <davidb@stashtea.com>
date Sun, 03 May 2020 16:15:10 -0700
parents bcbc92ffe0d0
children 1aea8079484b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 #!/bin/bash
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
2 # A v. 2.0 Debian package is nothing but an ar(1) archive that contains
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 # three members:
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 # 1. A debian-binary file containing the string "2.0" and a newline,
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
5 # 2. A compressed tar archive with a name of control,
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
6 # 3. A compressed tar archive with a name of data.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 # (See https://en.wikipedia.org/wiki/Deb_%28file_format%29.) Make one.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
8 #
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 # There are other ways to do this, but they tend to be so complex and
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 # badly-documented that I found it easier to just roll my own.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
11
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
12 # Name executed as
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 myname="${0##*/}"
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
14
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
15 # We must specify a single directory name, nothing else.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 if [ $# -ne 2 ]
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 then
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
18 1>&2 echo "$myname: expecting directory and output file"
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
19 exit 2
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 fi
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
21
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
22 # Change to the directory, die if we can't
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
23 cd "$1" || exit 2
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
24
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
25 # Do some sanity checks.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
26 for i in data control
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
27 do
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
28 if [ ! -d "$i" ]
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
29 then
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
30 1>&2 echo "$myname: '$1/$i', no such directory"
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
31 exit 2
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
32 fi
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
33 done
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
34
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
35 # If there is no debian-binary file, make one.
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
36 dbin="debian-binary"
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
37 if [ ! -e "$dbin" ]
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
38 then
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
39 1>&2 echo "$myname: warning - '$dbin' does not exist, creating it"
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
40 echo "2.0" > "$dbin" || exit 1
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
41 fi
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
42
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
43 # Remember where we are, and bail on errors
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
44 set -e
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
45
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
46 # Process data
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
47 cd data
44
6999afa6fff3 Update Building instructions; minor build system bug fixes.
David Barts <davidb@stashtea.com>
parents: 35
diff changeset
48 find * -type f -print0 | xargs -0 md5sum > ../control/md5sums
35
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
49 tar -c -z --owner=0 --group=0 -f ../data.tar.gz *
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
50
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
51 # Process control
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
52 cd ../control
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
53 tar -c -z --owner=0 --group=0 -f ../control.tar.gz *
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
54
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
55 # Finally, make deb file
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
56 cd ..
bcbc92ffe0d0 Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
David Barts <n5jrn@me.com>
parents:
diff changeset
57 ar r "$2" "$dbin" control.tar.gz data.tar.gz