Bob Zoller

ruby, rails, san francisco, photography, startups, food

I work at Aardvark.

create a simple .deb package


#!/bin/bash

# This script should be run from within the directory with the wav files.

# First, create the empty tree under a new "build" directory
# (the name "build" is completely arbitrary here)
mkdir -p build/usr/bin

# Put the sounds in the sounds directory
cp -v degrib/src/degrib/degrib build/usr/bin

# move into the build directory, make a docs directory
cd build
mkdir -p usr/share/doc/degrib

# write the README file
cat > usr/share/doc/degrib/README  control 
Description: degrib from the NWS.
 
 more info: http://www.nws.noaa.gov/mdl/degrib/
END

# Setting this environment variable fixes Apple's modified GNU tar so that
# it won't make dot-underscore AppleDouble files. Google it for details...
export COPY_EXTENDED_ATTRIBUTES_DISABLE=1

# create the data tarball
# (the tar options "czvf" mean create, zip, verbose, and filename.)
tar czvf data.tar.gz usr/bin/ usr/share/doc/

# create the control tarball
tar czvf control.tar.gz control

# create the debian-binary file
echo 2.0 > debian-binary

# create the ar (deb) archive
ar -r degrib-amd64.deb debian-binary control.tar.gz data.tar.gz

# move the new deb up a directory
mv degrib-amd64.deb ..

# remove the tarballs, and cd back up to where we started
rm data.tar.gz control.tar.gz
cd ..