From 460641370114eb380c10d9b6bed34ed2c9b4735e Mon Sep 17 00:00:00 2001 From: ficus Date: Mon, 24 Sep 2012 17:06:24 +0200 Subject: proper debian packaging and init.d script --- .gitignore | 6 ++++++ README | 5 ++++- TODO | 14 -------------- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 12 ++++++++++++ debian/rules | 9 +++++++++ debian/torouterui.init | 45 +++++++++++++++++++++++++++++++++++++++++++++ debian/torouterui.postinst | 9 +++++++++ debian/torouterui.postrm | 3 +++ debian/torouterui.prerm | 12 ++++++++++++ 11 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 debian/torouterui.init create mode 100644 debian/torouterui.postinst create mode 100644 debian/torouterui.postrm create mode 100644 debian/torouterui.prerm diff --git a/.gitignore b/.gitignore index 0ab2549..4844e86 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,9 @@ build dist *.egg-info +deb_dist +debian/files +debian/torouterui.debhelper.log +debian/*debhelper +debian/torouterui.substvars +debian/torouterui/ diff --git a/README b/README index 6df5cf1..ddeb357 100644 --- a/README +++ b/README @@ -52,5 +52,8 @@ tomfoolery, but if not, you can install system-wide: To build a one-off debian package, install ``python-stdeb`` and then run: - $ python setup.py --command-packages=stdeb.command bdist_deb + $ dpkg-buildpackage + +Packages and associated cruft will end up in the parent directory (outside the +torouterui repository checkout). diff --git a/TODO b/TODO index 78ca990..35d6f2a 100644 --- a/TODO +++ b/TODO @@ -45,28 +45,14 @@ # Soon -- resolve super-slow status lookup problem. err? note: dreamplug is Python - 2.7.3rc2 - ifup/down doesn't set link status? -- lan/wan eth0/eth1 mixup -- use uaputl (not iw) for wireless stuff if a uap device -- hostname, iw, nl80211 dependancies (?) -- remove hostname -f stuff (sigh) - CSS: blank space at top -- timeout on popen? wlan0 issue. -- port and ip as args -- uap0 as default (?) -- add setuptools (python-setuptools) dependancy -- init.d script - display DHCP lease status of WAN port - modify DHCP lease settings for ethernet LAN - enable/disable hotplug in interfaces when method changes # Then -- debian packaging - http://pypi.python.org/pypi/stdeb - http://stackoverflow.com/questions/909138/how-do-i-add-an-init-d-script-into-a-deb?rq=1 - admin authentication scheme - only listen on local ethernet interface (enforce with firewall?) - not-root permissions scheme for: interfaces, tor, wireless, ssh keys diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..8e5bda8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +torouterui (0.0-1) unstable; urgency=low + + * source package automatically created by stdeb 0.6.0+git + + -- unknown Mon, 24 Sep 2012 16:32:34 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e91acfb --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: torouterui +Maintainer: unknown +Section: python +Priority: optional +Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7.4.3) +Standards-Version: 3.9.1 + +Package: torouterui +Architecture: all +Depends: ${misc:Depends}, ${python:Depends}, python-setuptools, uaputl, python-flask, python-augeas, hostname, ifupdown, iw +Description: torouter configuration web interface + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2503da9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +# This file was automatically generated by stdeb 0.6.0+git at +# Mon, 24 Sep 2012 16:32:34 +0200 + +%: + dh $@ --with python2 --buildsystem=python_distutils + + diff --git a/debian/torouterui.init b/debian/torouterui.init new file mode 100644 index 0000000..26ff519 --- /dev/null +++ b/debian/torouterui.init @@ -0,0 +1,45 @@ +#!/bin/sh -e + +### BEGIN INIT INFO +# Provides: torouterui +# Required-Start: $local_fs $remote_fs $network +# Required-Stop: $local_fs $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: torouter configuration web interface +### END INIT INFO + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" +DAEMON=/usr/bin/torouterui +PIDFILE=/var/run/torouterui.pid + +[ -x "$DAEMON" ] || exit 0 + +. /lib/lsb/init-functions + +case "$1" in + start) + log_daemon_msg "Starting torouter Web Configuration Interface" "torouterui" + start-stop-daemon --start -b -m --pidfile $PIDFILE --exec $DAEMON + log_end_msg 0 + ;; + restart|force-reload) + $0 stop + $0 start + ;; + stop) + log_daemon_msg "Stopping torouter Web Configuration Interface" "torouterui" + start-stop-daemon --stop --pidfile $PIDFILE --oknodo + log_end_msg 0 + ;; + status) + status_of_proc $DAEMON torouterui + ;; + *) + echo "Usage: /etc/init.d/torouterui {start|stop|status}" + exit 2 + ;; + +esac + +exit 0 diff --git a/debian/torouterui.postinst b/debian/torouterui.postinst new file mode 100644 index 0000000..e61d07a --- /dev/null +++ b/debian/torouterui.postinst @@ -0,0 +1,9 @@ + +if which pycompile >/dev/null 2>&1; then + pycompile -p torouterui + echo "Not starting just now; do so with '/etc/init.d/torouterui start' as root" +fi + +if [ -x "/etc/init.d/torouterui" ]; then + update-rc.d torouterui defaults >/dev/null +fi diff --git a/debian/torouterui.postrm b/debian/torouterui.postrm new file mode 100644 index 0000000..c758975 --- /dev/null +++ b/debian/torouterui.postrm @@ -0,0 +1,3 @@ +if [ "$1" = "purge" ] ; then + update-rc.d torouterui remove >/dev/null +fi diff --git a/debian/torouterui.prerm b/debian/torouterui.prerm new file mode 100644 index 0000000..f8e1600 --- /dev/null +++ b/debian/torouterui.prerm @@ -0,0 +1,12 @@ +if [ -x "/etc/init.d/torouterui" ]; then + invoke-rc.d torouterui stop || exit $? +fi + +if which pyclean >/dev/null 2>&1; then + pyclean -p torouterui +else + dpkg -L torouterui | grep \.py$ | while read file + do + rm -f "${file}"[co] >/dev/null + done +fi -- cgit v1.2.3