Mercurial > cgi-bin > hgweb.cgi > JpegWasher
diff make-debian-package @ 35:bcbc92ffe0d0
Makes a .deb file at long last, but Duke still shows up as an icon in the dock.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 30 Apr 2020 21:22:30 -0700 |
parents | |
children | 6999afa6fff3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make-debian-package Thu Apr 30 21:22:30 2020 -0700 @@ -0,0 +1,57 @@ +#!/bin/bash +# A v. 2.0 Debian package is nothing but an ar(1) archive that contains +# three members: +# 1. A debian-binary file containing the string "2.0" and a newline, +# 2. A compressed tar archive with a name of control, +# 3. A compressed tar archive with a name of data. +# (See https://en.wikipedia.org/wiki/Deb_%28file_format%29.) Make one. +# +# There are other ways to do this, but they tend to be so complex and +# badly-documented that I found it easier to just roll my own. + +# Name executed as +myname="${0##*/}" + +# We must specify a single directory name, nothing else. +if [ $# -ne 2 ] +then + 1>&2 echo "$myname: expecting directory and output file" + exit 2 +fi + +# Change to the directory, die if we can't +cd "$1" || exit 2 + +# Do some sanity checks. +for i in data control +do + if [ ! -d "$i" ] + then + 1>&2 echo "$myname: '$1/$i', no such directory" + exit 2 + fi +done + +# If there is no debian-binary file, make one. +dbin="debian-binary" +if [ ! -e "$dbin" ] +then + 1>&2 echo "$myname: warning - '$dbin' does not exist, creating it" + echo "2.0" > "$dbin" || exit 1 +fi + +# Remember where we are, and bail on errors +set -e + +# Process data +cd data +find . -type f -print0 | xargs -0 md5sum > ../control/md5sums +tar -c -z --owner=0 --group=0 -f ../data.tar.gz * + +# Process control +cd ../control +tar -c -z --owner=0 --group=0 -f ../control.tar.gz * + +# Finally, make deb file +cd .. +ar r "$2" "$dbin" control.tar.gz data.tar.gz