#! /bin/sh # # makedeb.sh - Utility for easy packaging of binaries # Copyright (C) 2005-2007 Tommi Saviranta # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # Version: makedeb.sh v0.1.4 19-Mar-2013 wnd@iki.fi set -e tmpdir=__makedeb__tmp__ section=misc priority=optional maintainer="Maintainer Anonymous " version=0.1.0-1 branch=unstable urgency=low depends=apt recommends= arch= clean=yes while test $# -gt 0; do case $1 in --help) cat </dev/null 2>&1; then arch=$(dpkg-architecture -qDEB_BUILD_ARCH_CPU) else echo "Cannot get architecture with dpkg-architecture!" echo "Use --arch foo to enter it manually." exit 1 fi fi mkdir "$tmpdir" test "$clean" = "yes" && trap "rm -rf \"$tmpdir\"" 0 1 2 15 mkdir "$tmpdir/debian" echo 4 >"$tmpdir/debian/compat" cat <"$tmpdir/debian/changelog" $package ($version) $branch; urgency=$urgency * Packaged with makedeb. -- $maintainer $date EOF cat <"$tmpdir/debian/control" Source: $package Section: $section Priority: $priority Maintainer: $maintainer Build-Depends: debhelper (>= 4.0.0) Standards-Version: 3.6.0 Package: $package Section: $section Architecture: $arch Depends: $depends EOF test "$recommends" && echo "Recommends: $recommends" >>"$tmpdir/debian/control" test "$provides" && echo "Provides: $provides" >>"$tmpdir/debian/control" test "$replaces" && echo "Replaces: $replaces" >>"$tmpdir/debian/control" test "$conflicts" && echo "Conflicts: $conflicts" >>"$tmpdir/debian/control" cat <>"$tmpdir/debian/control" Description: $description $longdesc EOF test "$(find "$rootdir" -type f)" && files=yes if test "$files"; then cp -r -p "$rootdir"/* "$tmpdir" ls "$tmpdir" | grep -v debian >"$tmpdir/debian/$package.install" fi cat <"$tmpdir/debian/rules" #! /usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= \$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= \$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) config.status: configure dh_testdir build: build-stamp build-stamp: dh_testdir touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp dh_clean install: build dh_testdir dh_testroot dh_clean -k # Build architecture-independent files here. binary-indep: build install # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs dh_install dh_installdebconf dh_compress dh_fixperms dh_makeshlibs dh_installdeb dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install EOF chmod 755 "$tmpdir/debian/rules" test "$buildarch" && buildarch="-a$buildarch" (cd "$tmpdir"; fakeroot dpkg-buildpackage -b $buildarch)