From 1dd7f69fed060f27777f4f1bee50e60af32f6783 Mon Sep 17 00:00:00 2001 From: gandalf Date: Thu, 10 Jan 2008 01:38:06 +0000 Subject: [PATCH] modified script for debian package git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@52 251d49ef-1d17-4917-a970-b30cf55b089b --- debian/changelog | 12 +++++ debian/compat | 1 + debian/copyright | 32 ++++++++++++ debian/dirs | 8 +++ debian/postinst | 49 ++++++++++++++++++ debian/postrm | 46 +++++++++++++++++ debian/preinst | 43 ++++++++++++++++ debian/prometheus.control | 14 ++++++ debian/prometheus.patch | 24 +++++++++ debian/rules | 87 ++++++++++++++++++++++++++++++++ prometheus-debian.old | 94 +++++++++++++++++++++++++++++++++++ prometheus.debian | 101 +++++--------------------------------- 12 files changed, 422 insertions(+), 89 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 debian/preinst create mode 100644 debian/prometheus.control create mode 100644 debian/prometheus.patch create mode 100755 debian/rules create mode 100755 prometheus-debian.old diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9381195 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,12 @@ +prometheus (0.7.7-2) stable; urgency=low + + * Otestovani instalace a oprava chyb - prvni bastl ;-) + + -- gandalf Thu, 10 Jan 2008 02:18:33 +0100 + +prometheus (0.7.7-1) stable; urgency=low + + * First debian package + + -- gandalf Sat, 5 Jan 2008 15:45:42 +0100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..887b6ca --- /dev/null +++ b/debian/copyright @@ -0,0 +1,32 @@ +This package was debianized by gandalf on +Sat, 5 Jan 2008 15:45:42 +0100. + +It was downloaded from https://dev.arachne.cz/svn/prometheus/downloads + +Copyright: GNU+ Copyright(G)2007, Michael Polak (xChaos) +Credits: CZFree.Net, Netdave, aquarius + ...and Martin Devera (.cz) for his HTB qdisc (of course) + ...and Jakub Walczak (.pl) for providing feedback and patches + ...and Ing. Jiri Engelthaler (.cz) for bugfixes and Asus WL500 port + ...and Dial Telecom (slightly expensive ISP) for chance to test it + + +License: + + This package 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 package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..f7ac787 --- /dev/null +++ b/debian/dirs @@ -0,0 +1,8 @@ +usr/sbin +usr/share/man/man1 +usr/share/man/man5 +etc/default +etc/init.d +etc/cron.d +etc/prometheus +usr/share/doc/prometheus diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..126ed07 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,49 @@ +#!/bin/sh +# postinst script for prometheus +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + + /etc/prometheus/check-kernel-qos + + if [ -x "/etc/init.d/prometheus" ]; then + update-rc.d prometheus defaults 40 >/dev/null + /etc/init.d/prometheus restart + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..0ac0e5e --- /dev/null +++ b/debian/postrm @@ -0,0 +1,46 @@ +#!/bin/sh +# postrm script for prometheus +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|abort-install|disappear) + if [ -x "/etc/init.d/prometheus" ];then + /etc/init.d/prometheus stop + update-rc.d -f prometheus remove >/dev/null + fi + ;; + + upgrade|failed-upgrade|abort-upgrade) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..8cfb98a --- /dev/null +++ b/debian/preinst @@ -0,0 +1,43 @@ +#!/bin/sh +# preinst script for prometheus +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + upgrade) + if [ -x "/etc/init.d/prometheus" ]; then + /etc/init.d/prometheus stop + fi + ;; + + install) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + diff --git a/debian/prometheus.control b/debian/prometheus.control new file mode 100644 index 0000000..8dfce36 --- /dev/null +++ b/debian/prometheus.control @@ -0,0 +1,14 @@ +Source: __PACKAGE__ +Section: utils +Priority: standard +Maintainer: __MAINTAINER__ +Build-Depends: debhelper (>= 5) +Standards-Version: __VERSION__ +Version: __VERSION__ + +Package: __PACKAGE__ +Architecture: __ARCHITECTURE__ +Depends: iptables, iproute +Recommends: iptables, iproute +Description: Prometheus QoS (traffic shaper replacement for ISPs) + diff --git a/debian/prometheus.patch b/debian/prometheus.patch new file mode 100644 index 0000000..2adf521 --- /dev/null +++ b/debian/prometheus.patch @@ -0,0 +1,24 @@ +--- prometheus.c 2008-01-09 12:38:16.000000000 +0100 ++++ prometheus.c.deb 2008-01-09 15:51:48.098924554 +0100 +@@ -60,9 +60,9 @@ + char *config="/etc/prometheus/prometheus.conf"; /* main configuration file */ + char *hosts="/etc/prometheus/hosts"; /* line bandwidth definition file */ + char *tc="/sbin/tc"; /* requires tc with HTB support */ +-char *iptables="/usr/sbin/iptables"; /* requires iptables utility */ +-char *iptablessave="/usr/sbin/iptables-save"; /* new */ +-char *iptablesrestore="/usr/sbin/iptables-restore"; /* new */ ++char *iptables="/sbin/iptables"; /* requires iptables utility */ ++char *iptablessave="/sbin/iptables-save"; /* new */ ++char *iptablesrestore="/sbin/iptables-restore"; /* new */ + char *iptablesfile="/var/spool/prometheus.iptables"; /* new; file for iptables-restore*/ + char *iptablespreamble="*mangle\n:PREROUTING ACCEPT [0:0]\n:POSTROUTING ACCEPT [0:0]\n:INPUT ACCEPT [0:0]\n:OUTPUT ACCEPT [0:0]\n:FORWARD ACCEPT [0:0]"; + FILE *iptables_file=NULL; +@@ -72,7 +72,7 @@ + char *credit="/var/run/prometheus.credit"; /* credit log file */ + int enable_credit=1; /* enable credit file */ + int use_credit=0; /* use credit file (if enabled)*/ +-char *log_dir="/var/www/html/logs/"; /* log directory pathname */ ++char *log_dir="/var/www/logs/"; /* log directory pathname */ + char *log_url="logs/"; /* log directory URL prefix */ + char *title="Hall of Fame - Greatest Suckers"; /* hall of fame title */ + int hall_of_fame=1; /* enable hall of fame */ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7b5d313 --- /dev/null +++ b/debian/rules @@ -0,0 +1,87 @@ +#!/usr/bin/make -f + +CC = gcc +CFLAGS = -Wall -g + +bindir = /usr/sbin +mandir = /usr/share/man +sysconfdir = /etc +destdir = $(CURDIR)/debian/prometheus +docdir = /usr/share/doc + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +build: build-stamp + +build-stamp: + dh_testdir + $(CC) -o $(CURDIR)/prometheus $(CURDIR)/prometheus.c +# $(CC) -o $(CURDIR)/prometheus-monthly-stats $(CURDIR)/optional-tools/monthly-stats.c + + touch $@ + +clean: clean-dir + +clean-dir: + dh_testdir + dh_testroot + rm -f build-stamp + make clean + dh_clean + + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + install -m 755 -o root -g root $(CURDIR)/prometheus $(destdir)$(bindir) +# install -m 755 -o root -g root $(CURDIR)prometheus-monthly-stats $(destdir)$(bindir) + install -m 644 -o root -g root $(CURDIR)/prometheus.1 $(destdir)$(mandir)/man1 + install -m 644 -o root -g root $(CURDIR)/prometheus.conf.5 $(destdir)$(mandir)/man5 + install -m 755 -o root -g root $(CURDIR)/conf/prometheus.init $(destdir)$(sysconfdir)/init.d/prometheus + install -m 644 -o root -g root $(CURDIR)/conf/prometheus.default $(destdir)$(sysconfdir)/default/prometheus + install -m 755 -o root -g root $(CURDIR)/conf/prometheus.cron $(destdir)$(sysconfdir)/cron.d/prometheus + install -m 600 -o root -g root $(CURDIR)/conf/prometheus.hosts $(destdir)$(sysconfdir)/prometheus/hosts + install -m 600 -o root -g root $(CURDIR)/conf/prometheus.conf $(destdir)$(sysconfdir)/prometheus/prometheus.conf + install -m 700 -o root -g root $(CURDIR)/check-kernel-qos $(destdir)$(sysconfdir)/prometheus + install -m 644 -o root -g root $(CURDIR)/README $(destdir)$(docdir)/prometheus + install -m 644 -o root -g root $(CURDIR)/CHANGELOG $(destdir)$(docdir)/prometheus + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs CHANGELOG +# dh_installdocs +# dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo +# dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb +# dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-arch +.PHONY: build clean binary-arch binary install diff --git a/prometheus-debian.old b/prometheus-debian.old new file mode 100755 index 0000000..99cd5ef --- /dev/null +++ b/prometheus-debian.old @@ -0,0 +1,94 @@ +#!/bin/bash + +MAINTAINER='Michael Polak ' +DEB_PCK_NAME=prometheus +ARCHITECTURE=i386 +DEBIAN_BASE=$DEB_PCK_NAME.tmp + +# Adresare +rm -r $DEBIAN_BASE 2>/dev/null +mkdir -p $DEBIAN_BASE +mkdir -p $DEBIAN_BASE/usr +mkdir -p $DEBIAN_BASE/usr/sbin +mkdir -p $DEBIAN_BASE/usr/share +mkdir -p $DEBIAN_BASE/usr/share/man +mkdir -p $DEBIAN_BASE/usr/share/man/man1 +mkdir -p $DEBIAN_BASE/usr/share/man/man5 + +mkdir -p $DEBIAN_BASE/DEBIAN +chmod 0755 $DEBIAN_BASE/DEBIAN + +if ! [ -x prometheus ]; then + make main +fi + +# Copy +cp prometheus $DEBIAN_BASE/usr/sbin +cp prometheus.1 $DEBIAN_BASE/usr/share/man/man1 +cp prometheus.conf.5 $DEBIAN_BASE/usr/share/man/man5 +cp -R etc $DEBIAN_BASE/etc + +# .svn cleanup +rm -rf $DEBIAN_BASE/etc/.svn +rm -rf $DEBIAN_BASE/etc/*/.svn + +# Chmod a+x scripts +chmod 755 $DEBIAN_BASE/etc/cron.d/prometheus +chmod 755 $DEBIAN_BASE/etc/init.d/prometheus + +# Strip debug info from binary +strip $DEBIAN_BASE/usr/sbin/prometheus + +# Zmeni uzivatele a skupinu +chown -R root:root $DEBIAN_BASE + +# MD5 start +find $DEBIAN_BASE -type f -exec md5sum {} \; >> $DEBIAN_BASE/DEBIAN/_md5sum +# odstraneni $DEBIAN_BASE z adresare +sed -r "s:$DEBIAN_BASE::g" $DEBIAN_BASE/DEBIAN/_md5sum > $DEBIAN_BASE/DEBIAN/md5sum; +rm $DEBIAN_BASE/DEBIAN/_md5sum +# MD5 - end + +# Control file +cp -R $DEB_PCK_NAME.control $DEBIAN_BASE/DEBIAN/control +if [ -f $DEB_PCK_NAME'.postinst' ]; then + cp -R $DEB_PCK_NAME.postinst $DEBIAN_BASE/DEBIAN/postinst +fi +if [ -f $DEB_PCK_NAME'.preinst' ]; then + cp -R $DEB_PCK_NAME.preinst $DEBIAN_BASE/DEBIAN/preinst +fi +if [ -f $DEB_PCK_NAME'.conffiles' ]; then + cp -R $DEB_PCK_NAME.conffiles $DEBIAN_BASE/DEBIAN/conffiles +fi +if [ -f $DEB_PCK_NAME'.prerm' ]; then + cp -R $DEB_PCK_NAME.prerm $DEBIAN_BASE/DEBIAN/prerm +fi +if [ -f $DEB_PCK_NAME'.postrm' ]; then + cp -R $DEB_PCK_NAME.postrm $DEBIAN_BASE/DEBIAN/postrm +fi + +# Cleanup +for f in `find $DEBIAN_BASE/etc -path ".svn*"` +do + rm -R $f 2>/dev/null +done; + +# Momentalne se nepouziva +#SIZEDU=`du -sk "$DEBIAN_BASE" | awk '{ print $1}'` +#SIZEDIR=`find "$DEBIAN_BASE" -type d | wc | awk '{print $1}'` +#SIZE=$[ $SIZEDU - $SIZEDIR ] + +# Verze +VERSION=`grep "const char \*version" prometheus.c|cut -f 2 -d \"` + +# Control file +sed -e "s/__VERSION__/$VERSION/" \ + -e "s/__PACKAGE__/$DEB_PCK_NAME/" \ + -e "s/__MAINTAINER__/$MAINTAINER/" \ + -e "s/__ARCHITECTURE__/$ARCHITECTURE/" \ + $DEB_PCK_NAME.control > $DEBIAN_BASE/DEBIAN/control + +# Vytvori a prejmenuje balicek +dpkg --build $DEBIAN_BASE +dpkg-name -o $DEBIAN_BASE.deb +rm -rf $DEBIAN_BASE diff --git a/prometheus.debian b/prometheus.debian index 99cd5ef..1f5308b 100755 --- a/prometheus.debian +++ b/prometheus.debian @@ -1,94 +1,17 @@ #!/bin/bash -MAINTAINER='Michael Polak ' -DEB_PCK_NAME=prometheus -ARCHITECTURE=i386 -DEBIAN_BASE=$DEB_PCK_NAME.tmp +arch=`dpkg-architecture -qDEB_HOST_ARCH` +version=`grep VERSION Makefile | gawk -F= '{ print $2 }'` +package=`grep PACKAGE Makefile | gawk -F= '{ print $2 }'` +maintainer='gandalf ' -# Adresare -rm -r $DEBIAN_BASE 2>/dev/null -mkdir -p $DEBIAN_BASE -mkdir -p $DEBIAN_BASE/usr -mkdir -p $DEBIAN_BASE/usr/sbin -mkdir -p $DEBIAN_BASE/usr/share -mkdir -p $DEBIAN_BASE/usr/share/man -mkdir -p $DEBIAN_BASE/usr/share/man/man1 -mkdir -p $DEBIAN_BASE/usr/share/man/man5 +patch -Nl debian/control -if ! [ -x prometheus ]; then - make main -fi - -# Copy -cp prometheus $DEBIAN_BASE/usr/sbin -cp prometheus.1 $DEBIAN_BASE/usr/share/man/man1 -cp prometheus.conf.5 $DEBIAN_BASE/usr/share/man/man5 -cp -R etc $DEBIAN_BASE/etc - -# .svn cleanup -rm -rf $DEBIAN_BASE/etc/.svn -rm -rf $DEBIAN_BASE/etc/*/.svn - -# Chmod a+x scripts -chmod 755 $DEBIAN_BASE/etc/cron.d/prometheus -chmod 755 $DEBIAN_BASE/etc/init.d/prometheus - -# Strip debug info from binary -strip $DEBIAN_BASE/usr/sbin/prometheus - -# Zmeni uzivatele a skupinu -chown -R root:root $DEBIAN_BASE - -# MD5 start -find $DEBIAN_BASE -type f -exec md5sum {} \; >> $DEBIAN_BASE/DEBIAN/_md5sum -# odstraneni $DEBIAN_BASE z adresare -sed -r "s:$DEBIAN_BASE::g" $DEBIAN_BASE/DEBIAN/_md5sum > $DEBIAN_BASE/DEBIAN/md5sum; -rm $DEBIAN_BASE/DEBIAN/_md5sum -# MD5 - end - -# Control file -cp -R $DEB_PCK_NAME.control $DEBIAN_BASE/DEBIAN/control -if [ -f $DEB_PCK_NAME'.postinst' ]; then - cp -R $DEB_PCK_NAME.postinst $DEBIAN_BASE/DEBIAN/postinst -fi -if [ -f $DEB_PCK_NAME'.preinst' ]; then - cp -R $DEB_PCK_NAME.preinst $DEBIAN_BASE/DEBIAN/preinst -fi -if [ -f $DEB_PCK_NAME'.conffiles' ]; then - cp -R $DEB_PCK_NAME.conffiles $DEBIAN_BASE/DEBIAN/conffiles -fi -if [ -f $DEB_PCK_NAME'.prerm' ]; then - cp -R $DEB_PCK_NAME.prerm $DEBIAN_BASE/DEBIAN/prerm -fi -if [ -f $DEB_PCK_NAME'.postrm' ]; then - cp -R $DEB_PCK_NAME.postrm $DEBIAN_BASE/DEBIAN/postrm -fi - -# Cleanup -for f in `find $DEBIAN_BASE/etc -path ".svn*"` -do - rm -R $f 2>/dev/null -done; - -# Momentalne se nepouziva -#SIZEDU=`du -sk "$DEBIAN_BASE" | awk '{ print $1}'` -#SIZEDIR=`find "$DEBIAN_BASE" -type d | wc | awk '{print $1}'` -#SIZE=$[ $SIZEDU - $SIZEDIR ] - -# Verze -VERSION=`grep "const char \*version" prometheus.c|cut -f 2 -d \"` - -# Control file -sed -e "s/__VERSION__/$VERSION/" \ - -e "s/__PACKAGE__/$DEB_PCK_NAME/" \ - -e "s/__MAINTAINER__/$MAINTAINER/" \ - -e "s/__ARCHITECTURE__/$ARCHITECTURE/" \ - $DEB_PCK_NAME.control > $DEBIAN_BASE/DEBIAN/control - -# Vytvori a prejmenuje balicek -dpkg --build $DEBIAN_BASE -dpkg-name -o $DEBIAN_BASE.deb -rm -rf $DEBIAN_BASE +dpkg-buildpackage + -- 2.30.2