#!/bin/sh
#170519 sfs
#http://webhamster.ru/mytetrashare/index/mtb0/2046
#https://debian-handbook.info/browse/ru-RU/stable/packaging-system.html
[ ! -d "$1" ] && echo "Create .deb from directory
    Usage $o direttory_name" && exit 1 

if [ -f control ] ;then
    [ "`cat control |wc -m`" = "352" ] && echo "Edit file 'control'" && exit 1
else
 echo "\
Package: licq-plugin-icqnd
Architecture: i386
Depends: licq, adobe-flashplugin (= 1:20170509.1-0ubuntu0.14.04.1), libc6 (>= 2.7)
Provides: licq-plugin
Priority: optional
Version: 0.1.9.3
Maintainer: nobody care
Description: graphical user interface plug-in for Licq using GTK2
This package provides the GTK2-based graphical user interface to the Licq
" >control && echo "File 'control' created/ Edit it" && exit
fi
tar czf control.tar.gz control
echo 2.0 > debian-binary
cd "$1" && tar czf ../data.tar.gz *
cd ..
A(){ awk '/^'$1':/ {print $2}' control  ; }
ar -qS "`A Package`_`A Version`_`A Architecture`".deb debian-binary control.tar.gz data.tar.gz

