#!/bin/sh

#Installiert ein Binärpaket für Debian

TMPDIR="/tmp/dir-$$"
FILE="$1"
APPNAME=`basename $FILE`
DIR="usr/bin"
VERSION="1.0-1"
 
mkdir $TMPDIR

echo "2.0" > $TMPDIR/debian-binary

mkdir $TMPDIR/control
md5sum "$FILE" > $TMPDIR/control/md5sums
cat > $TMPDIR/control/control << HERE 
Package: $APPNAME
Version: $VERSION
Section: base
Priority: optional
Architecture: all
Installed-Size: `ls -l $FILE | awk '{print $5}'`
Maintainer: Markus Raab 
Description: Binary File
 The GNU hello program produces a familiar, friendly greeting. It 
 allows nonprogrammers to use a classic computer science tool which 
 would otherwise be unavailable to them. 
 . 
 Seriously, though: this is an example of how to do a Debian package. 
 It is the Debian version of the GNU Project's hello world program 
 (which is itself an example for the GNU Project).

HERE
	

mkdir -p $TMPDIR/data/"$DIR"
cp $FILE $TMPDIR/data/"$DIR"

RESTORE=`pwd`
cd $TMPDIR/control
tar -czf $TMPDIR/control.tar.gz *
cd $TMPDIR/data
tar -czf $TMPDIR/data.tar.gz *
cd "$RESTORE"

#TODO Reihenfolge war falsch!!!
ar qc $APPNAME.a $TMPDIR/debian-binary $TMPDIR/control.tar.gz $TMPDIR/data.tar.gz
mv $APPNAME.a ${APPNAME}_$VERSION-1_all.deb

rm -r $TMPDIR

Fr Jul 30 13:54:24 CEST 2021
patent_button.gif valid-html401.png elektra.jpg fsfe-logo.png valid-css.png vim.gif anybrowser.gif