From 4542b74154d50f1106a86691815b530593980803 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Thu, 28 Apr 2011 20:30:25 +0200 Subject: [PATCH] Prva inacica paketa za Debian squeeze distribuciju. --- debian/README.CARNet => README.CARNet | 4 +- debian/changelog | 11 ++ debian/changelog.CARNet | 1 - debian/compat | 2 +- debian/control | 10 +- debian/copyright | 7 + debian/docs | 3 +- debian/lintian-overrides | 1 + debian/postinst | 321 ++++++++++++++++----------------- debian/rules | 69 +------ 10 files changed, 187 insertions(+), 242 deletions(-) rename debian/README.CARNet => README.CARNet (94%) delete mode 120000 debian/changelog.CARNet create mode 100644 debian/copyright delete mode 100644 debian/dirs create mode 100644 debian/lintian-overrides diff --git a/debian/README.CARNet b/README.CARNet similarity index 94% rename from debian/README.CARNet rename to README.CARNet index 9b73ec1..77a4a60 100644 --- a/debian/README.CARNet +++ b/README.CARNet @@ -1,5 +1,5 @@ xinetd-cn ---------- +~~~~~~~~~ Ovaj paket donosi CARNetove postavke za xinetd "Internet services daemon". @@ -38,4 +38,4 @@ direktoriju. Takva konfiguracija ima prednost nad onom iz /etc/inetd.conf. - -- Dragan Dosen Thu, 18 Dec 2008 18:32:35 +0100 + -- Dragan Dosen Wed, 27 Apr 2011 20:50:34 +0200 diff --git a/debian/changelog b/debian/changelog index eff2c2e..2a79777 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +xinetd-cn (1:2.3.14+1) stable; urgency=low + + * Prva inacica paketa za Debian squeeze distribuciju. + * Nova debian/rules datoteka. + * Azurirane ovisnosti unutar debian/control. + * Izmjene unutar datoteke debian/postinst. + * Razni Lintian popravci, dodan copyright, promjena inacice + paketa u Debian native. + + -- Dragan Dosen Wed, 27 Apr 2011 20:50:34 +0200 + xinetd-cn (1:2.3.14-3lenny1) stable; urgency=low * Upgrade paketa za Debian lenny. diff --git a/debian/changelog.CARNet b/debian/changelog.CARNet deleted file mode 120000 index 194579e..0000000 --- a/debian/changelog.CARNet +++ /dev/null @@ -1 +0,0 @@ -changelog.Debian \ No newline at end of file diff --git a/debian/compat b/debian/compat index b8626c4..7f8f011 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -4 +7 diff --git a/debian/control b/debian/control index 04c19be..4e4b92f 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,12 @@ Source: xinetd-cn Section: net Priority: optional Maintainer: Dragan Dosen -Build-Depends: debhelper (>= 4.0.0) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 7) +Standards-Version: 3.9.1 Package: xinetd-cn Architecture: all -Depends: xinetd (>= 1:2.3.14-7), debianutils, coreutils (>= 6.10-6), carnet-tools-cn (>= 2.8.1) +Depends: xinetd (>= 1:2.3.14-7), coreutils (>= 6.10-6), debianutils (>= 2.30), carnet-tools-cn (>= 3.0.0), ${misc:Depends} 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 @@ -22,7 +22,5 @@ Description: replacement for inetd with many enhancements network, but not the rest of the world. Or to have a different service running on the same port, but different interfaces. . - Homepage: http://www.xinetd.org - . This is a basic CARNet Debian customization package. - +Homepage: http://www.xinetd.org diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..5350ae7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,7 @@ +Copyright 2011 CARNet + +You are free to distribute this software package under the terms of the +GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file /usr/share/common-licenses/GPL. diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index e69de29..0000000 diff --git a/debian/docs b/debian/docs index 9f08072..8f6e250 100644 --- a/debian/docs +++ b/debian/docs @@ -1,2 +1 @@ -debian/README.CARNet -debian/changelog.CARNet \ No newline at end of file +README.CARNet diff --git a/debian/lintian-overrides b/debian/lintian-overrides new file mode 100644 index 0000000..357cd1c --- /dev/null +++ b/debian/lintian-overrides @@ -0,0 +1 @@ +xinetd-cn: latest-debian-changelog-entry-changed-to-native diff --git a/debian/postinst b/debian/postinst index 7e01fae..a39035e 100644 --- a/debian/postinst +++ b/debian/postinst @@ -13,6 +13,7 @@ CONF=/etc/xinetd.conf INETDCONF=/etc/inetd.conf DEFAULT=/etc/default/xinetd BACKUPDIR=/var/backups/xinetd-cn +XCONV_TOOL=/usr/sbin/xconv.pl need_restart=0 temp_files= @@ -23,15 +24,15 @@ xinetd_conf_did=0 # Cleanup all temp files. # cleanup () { - - local item - if [ -n "$temp_files" ]; then - for item in $temp_files; do - if [ -e "$item" ]; then - rm -f $item - fi - done - fi + local item + + if [ -n "$temp_files" ]; then + for item in $temp_files; do + if [ -e "$item" ]; then + rm -f $item + fi + done + fi } # backup_and_disable_service() @@ -40,25 +41,24 @@ cleanup () { # Arguments: service, services_file # backup_and_disable_service () { + local serv servfile out + serv="$1" + servfile="$2" - local serv servfile out - serv="$1" - servfile="$2" - - if cp_backup_conffile -r -d $BACKUPDIR -p /etc/xinetd.d/$servfile; then - cp_echo "CN: Old /etc/xinetd.d/$servfile saved as $BACKUPDIR/`basename /etc/xinetd.d/$servfile`.bak." - fi + if cp_backup_conffile -r -d $BACKUPDIR -p /etc/xinetd.d/$servfile; then + cp_echo "CN: Old /etc/xinetd.d/$servfile saved as $BACKUPDIR/`basename /etc/xinetd.d/$servfile`.bak." + fi - cp_echo "CN: Disabling service '$serv' in configuration file /etc/xinetd.d/$servfile." + cp_echo "CN: Disabling service '$serv' in configuration file /etc/xinetd.d/$servfile." - out=`mktemp /etc/xinetd.d/$servfile.tmp.XXXXXX` - temp_files="$temp_files $out" + out=`mktemp /etc/xinetd.d/$servfile.tmp.XXXXXX` + temp_files="$temp_files $out" - sed -r "/^[[:space:]]*service[[:space:]]+$serv[[:space:]]*$/,/^}/ s/^(.*)/#\1/" \ - /etc/xinetd.d/$servfile > $out - rm -f /etc/xinetd.d/$servfile - mv "$out" "/etc/xinetd.d/$servfile" - chmod 644 "/etc/xinetd.d/$servfile" + sed -r "/^[[:space:]]*service[[:space:]]+$serv[[:space:]]*$/,/^}/ s/^(.*)/#\1/" \ + /etc/xinetd.d/$servfile > $out + rm -f /etc/xinetd.d/$servfile + mv "$out" "/etc/xinetd.d/$servfile" + chmod 644 "/etc/xinetd.d/$servfile" } # Set trap for deleting all temp files. @@ -68,19 +68,18 @@ trap cleanup 0 1 2 15 # First, we do backup (inetd, xinetd) # if cp_backup_conffile -r -d $BACKUPDIR -p $INETDCONF; then - cp_echo "CN: Old $INETDCONF saved as $BACKUPDIR/`basename $INETDCONF`.bak." + cp_echo "CN: Old $INETDCONF saved as $BACKUPDIR/`basename $INETDCONF`.bak." fi if cp_backup_conffile -r -d $BACKUPDIR -p $CONF; then - cp_echo "CN: Old $CONF saved as $BACKUPDIR/`basename $CONF`.bak." + cp_echo "CN: Old $CONF saved as $BACKUPDIR/`basename $CONF`.bak." fi CONFTMP=`mktemp $CONF.tmp.XXXXXX` temp_files="$CONFTMP" if [ -f "$INETDCONF" ]; then - - # Convert inetd.conf to temporary xinetd.conf file using xconv.pl tool - egrep -v "^##" $INETDCONF | /usr/sbin/xconv.pl > $CONFTMP || true + # Convert inetd.conf to temporary xinetd.conf file using xconv.pl tool + egrep -v "^##" $INETDCONF | $XCONV_TOOL > $CONFTMP || true fi # Parse /etc/xinetd.conf file and convert services' configuration to @@ -88,10 +87,10 @@ fi # conffile_list="$CONFTMP" if [ -f "$CONF" ]; then - if egrep -q "^[[:space:]]*service[[:space:]]+" "$CONF"; then - conffile_list="$CONF $conffile_list" - xinetd_conf_did=1 - fi + if egrep -q "^[[:space:]]*service[[:space:]]+" "$CONF"; then + conffile_list="$CONF $conffile_list" + xinetd_conf_did=1 + fi fi services_list="`sed -nr 's/^[[:space:]]*service[[:space:]]+//p' $conffile_list | uniq`" @@ -99,31 +98,29 @@ if [ -n "$services_list" ]; then for service in $services_list; do - if [ -f "/etc/xinetd.d/$service" ]; then - - if cp_backup_conffile -r -d $BACKUPDIR -p /etc/xinetd.d/$service; then - cp_echo "CN: Old /etc/xinetd.d/$service saved as $BACKUPDIR/`basename /etc/xinetd.d/$service`.bak." - fi + if [ -f "/etc/xinetd.d/$service" ]; then + if cp_backup_conffile -r -d $BACKUPDIR -p /etc/xinetd.d/$service; then + cp_echo "CN: Old /etc/xinetd.d/$service saved as $BACKUPDIR/`basename /etc/xinetd.d/$service`.bak." + fi + rm -f /etc/xinetd.d/$service + fi - rm -f /etc/xinetd.d/$service - fi + touch /etc/xinetd.d/$service || true + # cat "$CONF" "$CONFTMP" | sed -n "/^service $service/,/^}/p" | cp-update "$PKG" "/etc/xinetd.d/$service" + sed -rn "/^[[:space:]]*service[[:space:]]+$service[[:space:]]*$/,/^}/p" \ + $conffile_list >> "/etc/xinetd.d/$service" - touch /etc/xinetd.d/$service || true - # cat "$CONF" "$CONFTMP" | sed -n "/^service $service/,/^}/p" | cp-update "$PKG" "/etc/xinetd.d/$service" - sed -rn "/^[[:space:]]*service[[:space:]]+$service[[:space:]]*$/,/^}/p" \ - $conffile_list >> "/etc/xinetd.d/$service" - - need_restart=1 + need_restart=1 done if egrep -q "^[[:space:]]*service[[:space:]]+" "$CONFTMP"; then - cp_echo "CN: All services were converted from $INETDCONF file to separated" - cp_echo "CN: configuration files located in /etc/xinetd.d/ directory." + cp_echo "CN: All services were converted from $INETDCONF file to separated" + cp_echo "CN: configuration files located in /etc/xinetd.d/ directory." fi if [ $xinetd_conf_did -eq 1 ]; then - cp_echo "CN: All services were converted from $CONF file to separated" - cp_echo "CN: configuration files located in /etc/xinetd.d/ directory." + cp_echo "CN: All services were converted from $CONF file to separated" + cp_echo "CN: configuration files located in /etc/xinetd.d/ directory." fi fi @@ -132,33 +129,37 @@ rm -f $CONFTMP # Configuration file /etc/xinetd.conf does not exist? # if [ ! -f "$CONF" ]; then - touch "$CONF" + touch "$CONF" fi +CONF_CONTENT= # Remove services from /etc/xinetd.conf file # cp_check_and_sed "^[[:space:]]*service[[:space:]]+" \ - "/^[[:space:]]*service[[:space:]]/,/^}/d" \ - "$CONF" && need_restart=1 || true + "/^[[:space:]]*service[[:space:]]/,/^}/d" \ + "$CONF" && need_restart=1 || true # Check if there is no defaults block in /etc/xinetd.conf # if ! egrep -q '^defaults' "$CONF"; then + cp_echo "CN: Adding defaults block to $CONF" + CONF_CONTENT="defaults +{ - echo -e "defaults\n{\n\n}" | cp-update -m "$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 + cp_echo "CN: Adding \"includedir /etc/xinetd.d\" line to $CONF" + CONF_CONTENT="$CONF_CONTENT +includedir /etc/xinetd.d" +fi - echo "includedir /etc/xinetd.d" | cp-update -m "$PKG" "$CONF" - cp_echo "CN: Added \"includedir /etc/xinetd.d\" line to $CONF" - - need_restart=1 +if [ -n "$CONF_CONTENT" ]; then + echo "$CONF_CONTENT" | cp-update -m "$PKG" "$CONF" + need_restart=1 fi # Validate services' configuration. @@ -167,124 +168,118 @@ services_file_list="`ls -1 /etc/xinetd.d/`" if [ -n "$services_file_list" ]; then for services_file in $services_file_list; do - - # Get services list from $services_file - services_list="`sed -rn "s/^[[:space:]]*service[[:space:]]+(.*)[[:space:]]*$/\1/p" /etc/xinetd.d/$services_file`" - - if [ -n "$services_list" ]; then - - for service in $services_list; do - - service_disable=0 - service_block="`sed -rn "/^[[:space:]]*service[[:space:]]+$service[[:space:]]*$/,/^}/p" /etc/xinetd.d/$services_file`" - - # Check service's user - service_user="`echo "$service_block" | sed -nr "s/^[[:space:]]*user[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" - if [ -n "$service_user" ]; then - - for service_user_x in $service_user; do - service_user_chk="`getent passwd $service_user_x`" || true - if [ -z "$service_user_chk" ]; then - cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - user '$service_user_x' does not exist." - service_disable=1 - break - fi - done - fi - - # Check service's group - service_group="`echo "$service_block" | sed -nr "s/^[[:space:]]*group[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" - if [ -n "$service_group" ]; then - - for service_group_x in $service_group; do - service_group_chk="`getent passwd $service_group_x`" || true - if [ -z "$service_group_chk" ]; then - cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - group '$service_group_x' does not exist." - service_disable=1 - break - fi - done - fi - - # Check service's binary - service_server="`echo "$service_block" | sed -nr "s/^[[:space:]]*server[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" - if [ -n "$service_server" ]; then - - for service_server_x in $service_server; do - if [ ! -x "$service_server_x" ]; then - cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - server '$service_server_x' does not exist." - service_disable=1 - break - fi - done - fi - - if [ $service_disable -eq 1 ]; then - backup_and_disable_service "$service" "$services_file" - need_restart=1 - fi - done - fi + # Get services list from $services_file + services_list="`sed -rn "s/^[[:space:]]*service[[:space:]]+(.*)[[:space:]]*$/\1/p" /etc/xinetd.d/$services_file`" + + if [ -n "$services_list" ]; then + + for service in $services_list; do + service_disable=0 + service_block="`sed -rn "/^[[:space:]]*service[[:space:]]+$service[[:space:]]*$/,/^}/p" /etc/xinetd.d/$services_file`" + + # Check service's user + service_user="`echo "$service_block" | sed -nr "s/^[[:space:]]*user[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" + if [ -n "$service_user" ]; then + for service_user_x in $service_user; do + service_user_chk="`getent passwd $service_user_x`" || true + if [ -z "$service_user_chk" ]; then + cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - user '$service_user_x' does not exist." + service_disable=1 + break + fi + done + fi + + # Check service's group + service_group="`echo "$service_block" | sed -nr "s/^[[:space:]]*group[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" + if [ -n "$service_group" ]; then + for service_group_x in $service_group; do + service_group_chk="`getent passwd $service_group_x`" || true + if [ -z "$service_group_chk" ]; then + cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - group '$service_group_x' does not exist." + service_disable=1 + break + fi + done + fi + + # Check service's binary + service_server="`echo "$service_block" | sed -nr "s/^[[:space:]]*server[[:space:]]*=[[:space:]]*(.*)[[:space:]]*$/\1/p"`" + if [ -n "$service_server" ]; then + for service_server_x in $service_server; do + if [ ! -x "$service_server_x" ]; then + cp_echo "CN: Error in /etc/xinetd.d/$services_file for service '$service' - server '$service_server_x' does not exist." + service_disable=1 + break + fi + done + fi + + if [ $service_disable -eq 1 ]; then + backup_and_disable_service "$service" "$services_file" + need_restart=1 + fi + done + fi done fi # Remove -inetd_compat option and set INETD_COMPAT to 'No' in /etc/default/xinetd # if [ -f "$DEFAULT" ]; then - - # File exists, set INETD_COMPAT to 'No' - cp_check_and_sed "^[[:space:]]*INETD_COMPAT.*[Yy][Ee][Ss]" \ - "s/^[[:space:]]*INETD_COMPAT.*[Yy][Ee][Ss]/INETD_COMPAT=No/g" \ - "$DEFAULT" && need_restart=1 || true - - # File exists, remove -inetd_compat option - cp_check_and_sed "^[[:space:]]*XINETD_OPTS.*\-inetd_compat" \ - "s/\-inetd_compat//g" \ - "$DEFAULT" && need_restart=1 || true - - # No INETD_COMPAT line? - if ! egrep -q '^[[:space:]]*INETD_COMPAT' "$DEFAULT"; then - echo 'INETD_COMPAT=No' | cp-update -m "$PKG" "$DEFAULT" - cp_echo "CN: Added 'INETD_COMPAT=No' to $DEFAULT." - need_restart=1 - fi - - # Just in case there is no active XINETD_OPTS line - if ! egrep -q '^[[:space:]]*XINETD_OPTS' "$DEFAULT"; then - echo 'XINETD_OPTS="-stayalive"' | cp-update -m "$PKG" "$DEFAULT" - cp_echo "CN: Added -stayalive option to $DEFAULT." - need_restart=1 - fi -else - # File wasn't there at all? - touch $DEFAULT - echo -e 'INETD_COMPAT=No\nXINETD_OPTS="-stayalive"' | cp-update "$PKG" "$DEFAULT" - cp_echo "CN: Created $DEFAULT file with -stayalive enabled and -inetd_compat disabled." + # File exists, set INETD_COMPAT to 'No' + cp_check_and_sed "^[[:space:]]*INETD_COMPAT.*[Yy][Ee][Ss]" \ + "s/^[[:space:]]*INETD_COMPAT.*[Yy][Ee][Ss]/INETD_COMPAT=No/g" \ + "$DEFAULT" && need_restart=1 || true + + # File exists, remove -inetd_compat option + cp_check_and_sed "^[[:space:]]*XINETD_OPTS.*\-inetd_compat" \ + "s/\-inetd_compat//g" \ + "$DEFAULT" && need_restart=1 || true + + # No INETD_COMPAT line? + if ! egrep -q '^[[:space:]]*INETD_COMPAT' "$DEFAULT"; then + echo 'INETD_COMPAT=No' | cp-update -m "$PKG" "$DEFAULT" + cp_echo "CN: Added 'INETD_COMPAT=No' to $DEFAULT." + need_restart=1 + fi - need_restart=1 + # Just in case there is no active XINETD_OPTS line + if ! egrep -q '^[[:space:]]*XINETD_OPTS' "$DEFAULT"; then + echo 'XINETD_OPTS="-stayalive"' | cp-update -m "$PKG" "$DEFAULT" + cp_echo "CN: Added -stayalive option to $DEFAULT." + need_restart=1 + fi +else + # File wasn't there at all? + touch "$DEFAULT" + cp-update "$PKG" "$DEFAULT" < /dev/null || do=start - -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 + if [ -x "/etc/init.d/xinetd" ]; then + if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then + invoke-rc.d xinetd restart || exit $? + else + /etc/init.d/xinetd restart || exit $? + fi + fi fi # Mail root # cp_mail "$PKG" +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + exit 0 diff --git a/debian/rules b/debian/rules index b5f36e2..cbe925d 100755 --- a/debian/rules +++ b/debian/rules @@ -1,68 +1,3 @@ #!/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 +%: + dh $@ -- 1.7.10.4