From 3827c99deb79d7ccaf53776d83c91e70d478726a Mon Sep 17 00:00:00 2001 From: elliotkendall <elliotkendall@gmail.com> Date: Fri, 6 Jun 2014 12:35:12 -0700 Subject: [PATCH] Support actually building a Debian package --- Makefile | 13 +++++-------- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 12 ++++++++++++ debian/copyright | 21 +++++++++++++++++++++ debian/fanout.default | 2 +- debian/fanout.dirs | 1 + debian/fanout.init | 2 +- debian/postinst | 3 +++ debian/prerm | 2 ++ debian/rules | 5 +++++ debian/source/format | 1 + 12 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/fanout.dirs create mode 100644 debian/postinst create mode 100644 debian/prerm create mode 100644 debian/rules create mode 100644 debian/source/format diff --git a/Makefile b/Makefile index 0f54193..7617bc5 100644 --- a/Makefile +++ b/Makefile @@ -4,19 +4,16 @@ CC = gcc DEBUG = -g CFLAGS = -Wall -c $(DEBUG) LFLAGS = -Wall $(DEBUG) +DESTDIR = / .PHONY : $(OBJS) fanout : fanout.c $(CC) $(LFLAGS) $(OBJS) -o $(PROJ) fanout.c -debian-install: - -groupadd -f fanout - -useradd -g fanout -d /var/run/fanout -m -s /bin/false fanout - cp fanout /usr/local/bin - cp debian/fanout.init /etc/init.d/fanout - cp debian/fanout.default /etc/default/fanout +install: + mkdir -p $(DESTDIR)/usr/sbin + cp fanout $(DESTDIR)/usr/sbin/fanout clean: - \rm fanout - + test \! -f fanout || rm fanout diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8bef18f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +fanout (0.1-1) UNRELEASED; urgency=medium + + * Initial release. + + -- MAINTAINER <elliot.kendall@gmail.com> Fri, 06 Jun 2014 11:06:41 -0700 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..bbea912 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: fanout +Maintainer: Elliot Kendall <elliot.kendall@gmail.com> +Section: misc +Priority: optional +Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 9) + +Package: fanout +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: simple pubsub server + fanout is a simple pubsub server diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..ba31e1e --- /dev/null +++ b/debian/copyright @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2011-2012 Travis Glenn Hansen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/debian/fanout.default b/debian/fanout.default index 3c7526b..5f95c5e 100644 --- a/debian/fanout.default +++ b/debian/fanout.default @@ -2,4 +2,4 @@ # Default settings for fanout server # Options to pass to fanout -FANOUT_OPTS="--daemon --pidfile=/var/run/fanout.pid --run-as=fanout:fanout --logfile=/var/log/fanout.log --debug-level=2" +FANOUT_OPTS="--daemon --pidfile=/var/run/fanout.pid --run-as=fanout:fanout --logfile=/var/log/fanout/fanout.log --debug-level=2" diff --git a/debian/fanout.dirs b/debian/fanout.dirs new file mode 100644 index 0000000..db5f959 --- /dev/null +++ b/debian/fanout.dirs @@ -0,0 +1 @@ +/var/log/fanout diff --git a/debian/fanout.init b/debian/fanout.init index b9fae66..1d7dfc3 100755 --- a/debian/fanout.init +++ b/debian/fanout.init @@ -12,7 +12,7 @@ set -e SERVICE=fanout -DAEMON=/usr/local/bin/$SERVICE +DAEMON=/usr/sbin/$SERVICE PIDFILE=/var/run/$SERVICE.pid test -x $DAEMON || exit 0 diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..e696c37 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,3 @@ +groupadd -f fanout +useradd -g fanout -d /var/run/fanout -m -s /bin/false fanout +chown fanout:fanout /var/log/fanout diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..a93b53f --- /dev/null +++ b/debian/prerm @@ -0,0 +1,2 @@ +/etc/init.d/fanout stop +userdel fanout diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..65783e5 --- /dev/null +++ b/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f +%: + dh $@ +override_dh_auto_install: + $(MAKE) DESTDIR=$$(pwd)/debian/fanout install diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) -- GitLab