From ab7835109eacfed49f9747317a5161a964eff8e4 Mon Sep 17 00:00:00 2001 From: xchaos Date: Tue, 8 Jan 2008 12:16:52 +0000 Subject: [PATCH] target "make deb" + skript pro tvorbu debianiho balicku git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@40 251d49ef-1d17-4917-a970-b30cf55b089b --- Makefile | 3 ++ prometheus.conffiles | 3 ++ prometheus.control | 6 +++ prometheus.debian | 89 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 prometheus.conffiles create mode 100644 prometheus.control create mode 100755 prometheus.debian diff --git a/Makefile b/Makefile index 9c73178..f06bdd6 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ sysconfdir=/etc/ main: prometheus $(CC) -o prometheus prometheus.c +deb: main + ./prometheus.debian + install: main install -d $(sbindir) install -d $(mandir)/man1 diff --git a/prometheus.conffiles b/prometheus.conffiles new file mode 100644 index 0000000..9627fc8 --- /dev/null +++ b/prometheus.conffiles @@ -0,0 +1,3 @@ +/etc/prometheus/prometheus.conf +/etc/prometheus/hosts +/etc/cron.d/prometheus diff --git a/prometheus.control b/prometheus.control new file mode 100644 index 0000000..c2cf115 --- /dev/null +++ b/prometheus.control @@ -0,0 +1,6 @@ +Package: __PACKAGE__ +Version: __VERSION__ +Architecture: all +Depends: iptables, iproute +Maintainer: __MAINTAINER__ +Description: Prometheus QoS (traffic shaper replacement for ISPs) diff --git a/prometheus.debian b/prometheus.debian new file mode 100755 index 0000000..fd323b6 --- /dev/null +++ b/prometheus.debian @@ -0,0 +1,89 @@ +#!/bin/bash + +MAINTAINER='Michael Polak ' +DEB_PCK_NAME=prometheus +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/etc +mkdir -p $DEBIAN_BASE/etc/cron.d +mkdir -p $DEBIAN_BASE/etc/prometheus + +mkdir -p $DEBIAN_BASE/DEBIAN +chmod 0755 $DEBIAN_BASE/DEBIAN + +if ! [ -x prometheus ]; then + make main +fi + +# Data +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 sample-configuration/prometheus.cron $DEBIAN_BASE/etc/cron.d/prometheus +cp sample-configuration/prometheus.conf $DEBIAN_BASE/etc/prometheus +cp sample-configuration/hosts $DEBIAN_BASE/etc/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 + +# Asi zbytecne +#for f in `find $DEBIAN_BASE -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/" \ + $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 -- 2.30.2