Created
August 24, 2011 17:08
-
-
Save pelgrim/1168564 to your computer and use it in GitHub Desktop.
Just a script for generating deb packages Like a Boss :-)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for generating deb packages Like a Boss | |
# Developed by Lucas Vieira <lucas at heap dot com dot br> | |
# Exit with error when things go bad | |
if [ $# -ne 1 ] || [ ! -e "$1/DEBIAN/control" ]; then | |
echo "Bad argumentation. Try ./create_pkg [package_dir]" | |
exit 1 | |
fi | |
if [ ! $(which dpkg) ] && [ ! -x $DPKG ]; then | |
"Couldn't find dpkg. Please, export DPKG=[dpkg_path] && ./create_pkg [package_dir]" | |
exit 2 | |
fi | |
# Variables | |
[ $DPKG ] || DPKG=`which dpkg` | |
PACK=`grep Package: $1/DEBIAN/control | cut -d' ' -f2` | |
VERSION=`grep Version: $1/DEBIAN/control | cut -d' ' -f2` | |
ARCH=`grep Architecture: $1/DEBIAN/control | cut -d' ' -f2` | |
# The real thing | |
PACK_NAME=$PACK-$VERSION | |
[ $ARCH ] && PACK_NAME=$PACK_NAME"_"$ARCH | |
$DPKG --build $1 $PACK_NAME.deb | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment