From c9d4646aba37eed72c9b643bf15f1e0fed094643 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Sun, 28 Oct 2007 15:18:12 +0000 Subject: [PATCH] r1: [svn-inject] Installing original source of xinetd-cn --- debian/README.CARNet | 33 ++++++++++ debian/changelog | 37 +++++++++++ debian/changelog.CARNet | 1 + debian/compat | 1 + debian/control | 27 ++++++++ debian/docs | 2 + debian/postinst | 163 +++++++++++++++++++++++++++++++++++++++++++++++ debian/rules | 68 ++++++++++++++++++++ 8 files changed, 332 insertions(+) create mode 100644 debian/README.CARNet create mode 100644 debian/changelog create mode 120000 debian/changelog.CARNet create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/postinst create mode 100755 debian/rules diff --git a/debian/README.CARNet b/debian/README.CARNet new file mode 100644 index 0000000..89572a0 --- /dev/null +++ b/debian/README.CARNet @@ -0,0 +1,33 @@ +xinetd-cn +--------- + +Ovaj paket donosi CARNetove postavke za xinetd "Internet services +daemon". + + +INSTALACIJA: + +U slucaju da je unutar /etc/default/xinetd datoteke aktivna +-inetd_compat opcija, servisi zapisani u /etc/inetd.conf datoteci +bit ce automatski konvertirani u zasebne konfiguracijske datoteke +unutar /etc/xinetd.d/ direktorija. + +Servisi koji su konfigurirani unutar konfiguracijske datoteke +/etc/xinetd.conf bit ce takodjer automatski konvertirani u +zasebne konfiguracije u /etc/xinetd.d/ direktoriju. U datoteci +/etc/xinetd.conf ostat ce samo globalne opcije i linija koja +ukljucuje konfiguraciju iz /etc/xinetd.d/ direktorija. + + +VAZNA NAPOMENA: + +Opcija -inetd_compat se vise NE koristi. Dakle, xinetd vise +NECE citati servise konfigurirane u /etc/inetd.conf datoteci. + +Ukoliko zelite dodati novi servis ili konfigurirati vec postojece, +konfiguracija se nalazi u vec spomenutom /etc/xinetd.d/ +direktoriju. Takva konfiguracija ima prednost nad onom iz +/etc/inetd.conf. + + + -- Dragan Dosen Thu, 25 Oct 2007 21:21:33 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..305b369 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,37 @@ +xinetd-cn (1:2.3.14-1) stable; urgency=low + + * Prva inacica paketa za Debian etch distribuciju. + * Opcija -inetd_compat se vise ne koristi. + * Servisi zapisani u /etc/xinetd.conf i/ili /etc/inetd.conf + automatski se konvertiraju u zasebne konfiguracije unutar + /etc/xinetd.d/ direktorija. + + -- Dragan Dosen Thu, 25 Oct 2007 21:21:33 +0200 + +xinetd-cn (2:2.3.13-2) sarge; urgency=low + + * Ispravljen poziv cp_mail u postinst skripti. + + -- Zoran Dzelajlija Mon, 5 Sep 2005 14:01:02 +0200 + +xinetd-cn (2:2.3.13-1) sarge; urgency=low + + * Koristenje date umjesto 822-date. + * Nova verzija Debian paketa. + + -- Zoran Dzelajlija Wed, 25 Aug 2004 00:44:51 +0200 + +xinetd-cn (2:2.3.12-2) sarge; urgency=low + + * Izdanje za ftp. + * Dodatna provjera inetd_compat opcije. + * Novi maintainer. + + -- Zoran Dzelajlija Sun, 28 Mar 2004 22:40:33 +0200 + +xinetd-cn (2:2.3.12-1) testing unstable; urgency=low + + * Prvo izdanje paketa za obje arhitekture, zbog izdavanja CARNet + intel i sparc Debian distribucija. + + -- Bozo Juretic Fri, 12 Dec 2003 13:13:01 +0100 diff --git a/debian/changelog.CARNet b/debian/changelog.CARNet new file mode 120000 index 0000000..194579e --- /dev/null +++ b/debian/changelog.CARNet @@ -0,0 +1 @@ +changelog.Debian \ No newline at end of file diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..01c96a0 --- /dev/null +++ b/debian/control @@ -0,0 +1,27 @@ +Source: xinetd-cn +Origin: carnet +Section: net +Priority: extra +Maintainer: Dragan Dosen +Build-Depends: debhelper (>= 4.0.0) +Standards-Version: 3.6.1 + +Package: xinetd-cn +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, xinetd (>= 1:2.3.13-3), debianutils, coreutils (>= 5.0.91-1), carnet-tools-cn (>= 2.4) +Description: replacement for inetd with many enhancements + xinetd has access control mechanisms, extensive logging capabilities, + the ability to make services available based on time, and can place + limits on the number of servers that can be started, among other things. + . + It has the ability to redirect TCP streams to a remote host and port. + This is useful for those of that use ip masquerading, or NAT, and want + to be able to reach your internal hosts. + . + It also has the ability to bind specific services to specific interfaces. + This is useful when you want to make services available for your internal + network, but not the rest of the world. Or to have a different service + running on the same port, but different interfaces. + . + This is a basic CARNet Debian customization package. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..e69de29 diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..9f08072 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +debian/README.CARNet +debian/changelog.CARNet \ No newline at end of file diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..8c2f033 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,163 @@ +#!/bin/sh + +set -e + +[ "$1" = "configure" ] || exit 0 +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx + +# Load CARNet Tools +. /usr/share/carnet-tools/functions.sh + +PKG=xinetd-cn +CONF=/etc/xinetd.conf +INETDCONF=/etc/inetd.conf +DEFAULT=/etc/default/xinetd + +did_inetd_backup=0 +did_backup=0 +need_restart=0 + +# First, we do backup (inetd, xinetd) +# +if cp_check_and_backup "$INETDCONF"; then + did_inetd_backup=1 +fi +if cp_check_and_backup "$CONF"; then + did_backup=1 +fi + +# Print backup information +# +cp_echo "" +if [ $did_inetd_backup -eq 1 ]; then + cp_echo "CN: Old $INETDCONF saved as /var/backups/`basename $INETDCONF`.bak." +fi +if [ $did_backup -eq 1 ]; then + cp_echo "CN: Old $CONF saved as /var/backups/`basename $CONF`.bak." +fi + +# If there are some services enabled in /etc/inetd.conf, convert them to +# temporary xinetd configuration file. +# +[ -f "$DEFAULT" ] && inetd_compat="`grep '^XINETD_OPTS.*=.*\-inetd_compat' "$DEFAULT"`" || true +CONFTMP=`mktemp $CONF.tmp.XXXXXX` + +if [ -f "$INETDCONF" ] && [ -n "$inetd_compat" ]; then + + # Convert inetd.conf to temporary xinetd.conf file using xconv.pl tool + /usr/sbin/xconv.pl < $INETDCONF > $CONFTMP +fi + +# Parse /etc/xinetd.conf file and convert services' configuration to +# separated configurations in /etc/xinetd.d/ directory +# +services_list="`cat $CONF $CONFTMP | grep "^service " | uniq | sed 's/service //g'`" || true + +if [ -n "$services_list" ]; then + for service in $services_list; do + + if [ -f "/etc/xinetd.d/$service" ]; then + cp_check_and_backup "/etc/xinetd.d/$service" + + if ! egrep -q "^# .* update by CARNet package" "/etc/xinetd.d/$service"; then + rm -f /etc/xinetd.d/$service + fi + fi + + touch /etc/xinetd.d/$service || true + # cat "$CONF" "$CONFTMP" | sed -n "/^service $service/,/^}/p" | cp-update "$PKG" "/etc/xinetd.d/$service" + cat "$CONF" "$CONFTMP" | sed -n "/^service $service/,/^}/p" >> "/etc/xinetd.d/$service" + + need_restart=1 + done + + cp_echo "" + cp_echo "CN: All services were converted from $CONF file to separated configuration" + cp_echo "CN: files located in /etc/xinetd.d/ directory." + + if [ -n "$inetd_compat" ]; then + cp_echo "CN: Since -inetd_compat option was active, all services in $INETDCONF" + cp_echo "CN: file were also moved to /etc/xinetd.d/ directory." + fi + +fi + +rm -f $CONFTMP + +# Remove services from /etc/xinetd.conf file +# +cp_check_and_sed "^service " \ + "/^service/,/^}/d" \ + "$CONF" && need_restart=1 || true + +# Check if there is no defaults block in /etc/xinetd.conf +# +if ! egrep -q '^defaults' "$CONF"; then + + echo -e "defaults\n{\n\n}" | cp-update "$PKG" "$CONF" + cp_echo "CN: Added defaults block to $CONF" + + need_restart=1 +fi + +# Check if /etc/xinetd.d/ directory is included or not +# +if ! egrep -q '^includedir /etc/xinetd.d' "$CONF"; then + + echo "includedir /etc/xinetd.d" | cp-update "$PKG" "$CONF" + cp_echo "CN: Added \"includedir /etc/xinetd.d\" line to $CONF" + + need_restart=1 +fi + +# Remove -inetd_compat option from /etc/default/xinetd +# +if [ -f "$DEFAULT" ]; then + + # File exists, remove -inetd_compat option + cp_check_and_sed "^XINETD_OPTS.*\-inetd_compat" \ + "s/\-inetd_compat//g" \ + "$DEFAULT" && need_restart=1 || true + + # Just in case there is no active XINETD_OPTS line + if ! egrep -q '^XINETD_OPTS' "$DEFAULT"; then + + echo 'XINETD_OPTS="-stayalive"' | cp-update "$PKG" "$DEFAULT" + cp_echo "CN: Added -stayalive option to $DEFAULT." + + need_restart=1 + fi +else + # File wasn't there at all? + touch $DEFAULT + echo 'XINETD_OPTS="-stayalive"' | cp-update "$PKG" "$DEFAULT" + cp_echo "CN: Created $DEFAULT file with -stayalive option." + + need_restart=1 +fi + +# Restart xinetd if needed +# +if [ $need_restart -eq 1 ]; then + do=restart +fi +pgrep -u root -f /usr/sbin/xinetd > /dev/null || do=start + +cp_echo "" +if [ -n "$do" ]; then + + # Restart xinetd. + if [ -x "/etc/init.d/xinetd" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d xinetd "$do" || exit $? + else + /etc/init.d/xinetd "$do" || exit $? + fi + fi +fi + +# Mail root +# +cp_mail "$PKG" + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..b5f36e2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,68 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +#export DH_VERBOSE=1 + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_install -X.svn +# dh_installexamples +# dh_install +# dh_installmenu + dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link +# dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_python +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums -x + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure -- 1.7.10.4