Howto create Debian/Ubuntu (.deb) packages with dpkg
To distribute software for linux (especially true for Debian based distributions), the best way is to create .deb packages easy to install and maintain.
The script
The script below automates the task of building debian packages. You just need to modify the sections “VARIABLES”, “COPY”, “CONFIG”, “INFO” and “COPYRIGHT” then run it. Each section is clearly delimited and the modification you have to do are straight forward. Give it a try.
#!/bin/sh -x echo Creating package directory # SECTION -VARIABLES- PKG=voras VERSION=0.0.2 REVISION=1 # END SECTIN -VARIABLES- DEST=/tmp/$PKG rm -rf $DEST mkdir -p $DEST/DEBIAN mkdir -p $DEST/etc mkdir -p $DEST/usr/bin mkdir -p $DEST/etc/init.d mkdir -p $DEST/usr/share/man/man8 mkdir -p $DEST/etc/init.d/ echo Copying files in package directory # SECTION -COPY- cp hostapd $DEST/usr/bin/$PKG cp vorasd $DEST/etc/init.d/ cp voras.conf $DEST/etc/$PKG.conf cp eap_krb5.conf $DEST/etc/ cp voras.eap_user $DEST/etc/ cp voras.realms $DEST/etc/ cp voras.radius_clients $DEST/etc/ # END SECTION -COPY- cat << END > $DEST/DEBIAN/conffiles.ex # SECTION -CONFIG- /etc/voras.conf /etc/eap_krb5.conf /etc/voras.eap_user /etc/voras.radius_clients # END SECTION -CONFIG- END echo Creating debian packaging configuration files cat << END > $DEST/DEBIAN/control Package: $PKG Version: $VERSION Provides: $PKG # SECTION -INFO- Section: security Priority: optional Architecture: i386 Essential: no Depends: libssl-dev Installed-Size: 2M Maintainer: Saber Zrelli <zrelli@xxx.com> Description: RADIUS server with KRB5 authentication support # END SECTION -INFO- END echo Creating Changelog cp ChangeLog $DEST/DEBIAN/changelog echo Creating Copyright cat << END > $DEST/DEBIAN/copyright # SECTION -COPYRIGHT- All Rights Reserved. # END SECTION -COPYRIGHT- END cp ./postinst $DEST/DEBIAN/ cp ./prerm $DEST/DEBIAN/ echo Creating package dpkg -b $DEST $PKG\_$VERSION-$REVISION\_i386.deb
| Labels: Unix, coding |
|

Comment
Works Great! I like it. In 5 minutes I could create a deb package using this script.
Thanks a lot!
Fantastic - that what I was looking for. Thanks a lot.