Mercurial > cgi-bin > hgweb.cgi > JpegWasher
view make-debian-package @ 55:f5faf70c7d10
tabs to spaces
author | David Barts <davidb@stashtea.com> |
---|---|
date | Thu, 07 May 2020 14:21:23 -0700 |
parents | 1aea8079484b |
children |
line wrap: on
line source
#!/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 single directory name and an output file. 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